Sharphook is an asynchronous object oriented API wrapper for Discord's webhook API.
.NET Version | Compatible? |
---|---|
.NET 8 | YES |
.NET 7 | YES |
.NET 6 | YES |
.NET 5 | NO |
.NET 3.1 | NO |
.NET 3.0 | NO |
.NET 2.2 | NO |
.NET 2.1 | NO |
.NET 2.0 | NO |
.NET 1.1 | NO |
.NET 1.0 | NO |
- Go to releases
- Find the latest version
- Download the folder with your .NET version
- Unzip the folder
- Add Sharphook.dll as a reference to your project
(Nuget support coming in v1.0.0)
WebhookClient webhookClient = new WebhookClient();
PartialWebhook webhook = webhookClient.GetPartialWebhook(123, "Token");
await webhook.SendMessageAsync("Hello, world!");
WebhookClient webhookClient = new WebhookClient();
PartialWebhook webhook = webhookClient.GetPartialWebhook(123, "Token");
ulong threadId = 123;
await webhook.SendMessageInThreadAsync(threadId, "Hello, world!");
WebhookClient webhookClient = new WebhookClient();
PartialWebhook webhook = webhookClient.GetPartialWebhook(123, "Token");
Message message = await webhook.SendMessageAsync("Hello, world!", null, true);
Console.WriteLine(message.Id);
WebhookClient webhookClient = new WebhookClient();
PartialWebhook webhook = webhookClient.GetPartialWebhook(123, "Token");
// Edit webhook name
await webhook.EditNameAsync("New name");
// Edit webhook avatar
await webhook.EditAvatarAsync(@"newAvatar.png", ImageFormat.Png);
WebhookClient webhookClient = new WebhookClient();
PartialWebhook webhook = webhookClient.GetPartialWebhook(123, "Token");
ulong threadId = 123;
ulong messageId = 456;
try
{
await webhook.DeleteMessageInThreadAsync(
threadId,
messageId
);
}
catch (NotFound)
{
Console.WriteLine("Thread or message wasn't found.");
}
Sharphook is under the MIT license.
- Sharphook is just maintained for fun.
- Sharphook is in pre-release.