Description
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.
- Provides a comprehensive documentation.
- Uses methodmaps in order to provide support for the Transitional Syntax.
Requirements
-
RIPExt extension (included in the repo.)
How to use the include
1. Download the latest release and drop every file in your [code single]include/[/code] folder.
2. Add [code single]#include <discordWebhookAPI>[/code] to the top of your file.
3. Create your a basic WebHook message using the snippet below.
4. Get a Discord Webhook for your channel by following the tutorial
here.
5. See a full working example
here.
Code:
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!");
}
}
Example
SOURCE | LATEST RELEASE
__________________