virgiliopontes/discord-webhooks

一个简单的 Discord webhook 客户端库。

1.0.0 2020-09-02 04:12 UTC

This package is auto-updated.

Last update: 2024-09-29 06:02:43 UTC


README

Discord webhooks 是 Discord webhook API 的一个简单客户端。

动机

虽然这可能是 Discord webhook 系统的“又一”个库,但我还是想自己做一个。Discord 不支持 BitBucket 的 webhook 系统,并且与 Slack 兼容的端点不会发送消息。

入门

您可以直接将 PHP 文件复制到您的项目中,或者更推荐使用 composer。

Composer 安装命令

composer require virgiliopontes/discord-webhooks

用法

使用起来相当简单。我将给出一个示例。

use \DiscordWebhooks\Client;
use \DiscordWebhooks\Embed;

$webhook = new Client('DISCORD_WEBHOOK_URL');
$embed = new Embed();

$embed->description('This is an embed');

$webhook->username('Bot')->message('Hello, Human!')->embed($embed)->send();

许可证

本项目采用 MIT 许可证。要阅读完整许可证,请打开 LICENSE.md

贡献

合并请求和问题都是开放的!