/slack
to the end of a Discord webhook url for it to work.For added security, it is highly recommended to set your webhook path as an environment variable and use NWNX_Util_GetEnvironmentVariable() to construct your path.
The builder wants to be notified with a simple message when the module has completed start up
on_module_load
script, add the following: The builder wishes to create a function to post a bug report to the Discord developer channel.
The builder wishes to resend a WebHook when one is disallowed due to rate limitations.
OnModuleLoad
add: event_webhook
script and enter the following: The builder wishes to notify the general discord channel when a PC reaches a new level.
OnModuleLoad
add: event_level
script and enter the following: You may have noticed in this example how portraits are being used in the WebHooks as images. If you want to know how I converted portraits to images to use for this, here were the commands used:
Files | |
file | nwnx_webhook.nss |
file | nwnx_webhook_rch.nss |
Create richer webhook messages suitable for Discord. | |
Classes | |
struct | NWNX_WebHook_Message |
For more information on these fields see https://birdie0.github.io/discord-webhooks-guide/. More... | |
Functions | |
void | NWNX_WebHook_SendWebHookHTTPS (string host, string path, string message, string username="", int mrkdwn=1) |
Send a slack compatible webhook. More... | |
void | NWNX_WebHook_ResendWebHookHTTPS (string host, string path, string sMessage, float delay=0.0f) |
Resends a webhook message after a defined delay. More... | |
string | NWNX_WebHook_BuildMessageForWebHook (string host, string path, struct NWNX_WebHook_Message stMessage, int mrkdwn=1) |
Builds and sends a rich webhook message based on the constructed NWNX_WebHook_Message. More... | |
void NWNX_WebHook_SendWebHookHTTPS | ( | string | host, |
string | path, | ||
string | message, | ||
string | username = "" , |
||
int | mrkdwn = 1 |
||
) |
Send a slack compatible webhook.
host | The web server to send the hook. |
path | The path to the hook. |
message | The message to dispatch. |
username | The username to display as the originator of the hook. |
mrkdwn | Set to false if you do not wish your message's markdown be parsed. |
Definition at line 29 of file nwnx_webhook.nss.
void NWNX_WebHook_ResendWebHookHTTPS | ( | string | host, |
string | path, | ||
string | sMessage, | ||
float | delay = 0.0f |
||
) |
Resends a webhook message after a defined delay.
Handy when a submission is rate limited, since the message that the event sends in NWNX_Events_GetEventData is already constructed. So it just resends the WebHook with an optional delay.
host | The web server to send the hook. |
path | The path to the hook. |
sMessage | The message to dispatch. |
delay | The delay in seconds to send the message again. |
Definition at line 40 of file nwnx_webhook.nss.
string NWNX_WebHook_BuildMessageForWebHook | ( | string | host, |
string | path, | ||
struct NWNX_WebHook_Message | stMessage, | ||
int | mrkdwn = 1 |
||
) |
Builds and sends a rich webhook message based on the constructed NWNX_WebHook_Message.
host | The web server to send the hook. |
path | The path to the hook. |
stMessage | A constructed NWNX_Webhook_Message. |
mrkdwn | Set to false if you do not wish your message's markdown be parsed. |
Definition at line 77 of file nwnx_webhook_rch.nss.