Skip to content


The DiscordHook class enables sending messages and file attachments via webhooks directly to Discord. To utilize this functionality, configure a webhook in the desired Discord channel. For assistance setting up Discord webhooks, consult the guide below.


Sending Messages

To send a simple message, create an instance of DiscordHook with the webhook URL and call SendAsync with your message.


Hook hook = new DiscordHook(Url);

Sending Attachments

DiscordHook also supports sending files along with your messages. Attach files using a HashSet before calling SendAsync.


string url = "your_discord_webhook_url";
string message = "Check out this attachment!";
HashSet<FileInfo> attachments = new HashSet<FileInfo>
    new FileInfo("C:/path_to_your_file.jpg")

DiscordHook hook = new DiscordHook(url)
    Attachments = attachments

await hook.SendAsync(message);

Note: Ensure that the file paths provided to FileInfo are valid and the files are accessible.