An include featuring a well documented, complete wrapper of the Discord Webhook API written in SourcePawn using methodmaps and the RIPExt extension.
This include's aim is to make it easy for SourceMod developpers to send embeded WebHook messages to Discord servers, with minimal dependencies.
Contrary to other includes, discordWebhookAPI:
- Does not required a separate plugin to run alongside of it.
- Does not rely on SteamWorks or SM-Jansson.
- Is well documented.
- Allows to edit sent webhook messages.
- Provides a comprehensive documentation.
- Uses methodmaps in order to provide support for the Transitional Syntax.
- RIPExt extension (included in the repo.)
- Download the latest release and drop every file in your
include/
folder. - Add
#include <discordWebhookAPI>
to the top of your file. - Create your a basic WebHook message using the snippet below.
- Get a Discord Webhook for your channel by following the tutorial here.
- See a full working example here.
public Action SendDiscordWebhook(int client, int args)
{
Webhook webhook = new Webhook("This is the content of the webhook.");
webhook.Execute("https://discordapp.com/api/webhooks/6758765876/769876789009/", OnWebHookExecuted);
return Plugin_Continue;
}
public void OnWebHookExecuted(HTTPResponse response, DataPack pack)
{
if (response.Status == HTTPStatus_NoContent)
{
PrintToServer("Webhook sent successfully!");
}
}