forien/discord-webhooks
Composer 安装命令:
composer require forien/discord-webhooks
包简介
Simple wrapper for building and sending webhooks with Discord's webhook API
README 文档
README
Simple wrapper for building and sending webhooks with Discord's webhook API
Allows for both simple small uses (single Webhook object to single Hook (url)) and mass dispatchers for multiple channels or with multiple Webhook object.
Built with simple end-user OOP approach in mind (method chaining for example).
@todo README & documentation
// dispatcher manages building and sending webhooks $dispatch = \Forien\WebhookDispatcher::getInstance(); // to create new Webhook object you can use either: $webhook = $dispatch->createWebhook(); // or: $webhook = new \Forien\DiscordHelpers\Webhook(); $webhook->setContent('some basic text'); $embed = $webhook->addEmbed(); $embed->addAuthor(['name' => 'Forien', 'icon_url' => '/*...*/']); $embed->addField()->setName('name')->setValue('value'); $embed->addField()->setName('name2')->setValue('value2'); $embed->setColor('#cba'); // you can either add Hooks (Discord webhook urls) through either: $dispatch->addHook('https://...'); $dispatch->setHooks(['https://...', ...]) // you can send attach Webhook object to Dispatcher if you created it independly: $dispatch->addWebhook($webhook); // you can send all attached Webhook objects at once (every will be sent to every Hook): $dispatch->send() // you can also specify single webhook-hook: $dispatch->send($webhook, $hook);
统计信息
- 总下载量: 11
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 2
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: BSD-3-Clause
- 更新时间: 2018-04-09