Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/exitare/mod-discord-webhook
Send webhooks to discord using scripts
https://github.com/exitare/mod-discord-webhook
azerothcore-module
Last synced: 11 days ago
JSON representation
Send webhooks to discord using scripts
- Host: GitHub
- URL: https://github.com/exitare/mod-discord-webhook
- Owner: Exitare
- License: mit
- Created: 2024-12-14T00:33:41.000Z (25 days ago)
- Default Branch: main
- Last Pushed: 2024-12-14T04:02:31.000Z (25 days ago)
- Last Synced: 2024-12-14T04:25:04.466Z (25 days ago)
- Topics: azerothcore-module
- Language: C++
- Homepage:
- Size: 0 Bytes
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Acore Webhook Module
Welcome to the webhook module for azerothcore. This module will add functionality to let you send message to webhook endpoints (e.g. Discord).
## Installation
Please use this link for guidance how to install a module:
```https://www.azerothcore.org/wiki/installing-a-module```## Usage
- Copy the modules config and remove the .dist extension.
- Add your webhook url to the config. Save and restart your server## Example use
```cpp
#include "ScriptMgr.h"
#include "Player.h"
#include "Config.h"
#include "Chat.h"
#include "WebhookMgr.h" // add the mgr// Add player scripts
class WebhookPlayerLogin : public PlayerScript
{
public:
WebhookPlayerLogin() : PlayerScript("MyWebhookPlayerScript") { }void OnLogin(Player* player) override
{
std::stringstream ss;
ss << "Player " << player->GetName() << " just signed in.";std::string message = ss.str();
sWebhookMgr->ScheduleMessage(message); // Schedule the message
}
};// Add all scripts in one
void AddWebhookPlayerScripts()
{
new WebhookPlayerLogin();
}```
Add the script to the script loader. Can also be added in any other script loader.
webhook_loader.cpp
```cpp
void AddWebhookPlayerScripts();void Addacore_webhooksScripts()
{
AddWebhookPlayerScripts();
AddWebhookServerScripts();
}
```