Skip to content

An include featuring a well documented, complete wrapper of the Discord Webhook API written in SourcePawn using methodmaps and the RIPExt extension.

Notifications You must be signed in to change notification settings

Sarrus1/DiscordWebhookAPI

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

53 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

DiscordWebhookAPI

Complete wrapper of the Discord Webhook API written in SourcePawn

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.
  • Allows to edit sent webhook messages.
  • Provides a comprehensive documentation.
  • Uses methodmaps in order to provide support for the Transitional Syntax.

Requirements

How to use the include

  1. Download the latest release and drop every file in your include/ folder.
  2. Add #include <discordWebhookAPI> 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.
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

Example-send

Example-edit

About

An include featuring a well documented, complete wrapper of the Discord Webhook API written in SourcePawn using methodmaps and the RIPExt extension.

Resources

Stars

Watchers

Forks

Releases

No releases published