This is an API that allows you to easily send webhooks.
- Put it in the plugin folder.
- Add the "use Webhook\Webhook;" to the files you want to use.
- Use "Webhook::setWebhookUrl();" to set the destination.
- Use "Webhook::setColor();" to set the color.
- Use "Webhook::setTitle();" to set the title.
- Use "Webhook::setContents();" to set contents.
- Use "Webhook::sendWebhook();" to send a Webhook.
<?php
namespace Example;
use pocketmine\plugin\PluginBase;
use webhook\Webhook;
class Example extends PluginBase {
public function onEnable(): void {
Webhook::setWebhookUrl("https://discord.com/api/webhooks/00000");
Webhook::setColor("FFFFFF");
Webhook::setTitle("Webhook");
Webhook::setContents("This is a Webhook");
Webhook::sendWebhook();
}
}