ccaglayan/discord-webhooks-php 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

ccaglayan/discord-webhooks-php

最新稳定版本:0.1.0

Composer 安装命令:

composer require ccaglayan/discord-webhooks-php

包简介

A simple Discord webhook client library.

README 文档

README

Codacy Badge

Discord webhooks is a simple client for Discord's webhook API.

Composer require command

composer require ccaglayan/discord-webhooks-php

Usage

It is fairly easy to use. I'll throw in an example.

use DiscordWebhooksPHP\Client;

$client = new Client('DISCORD_WEBHOOK_URL');
try{
    $embedData = array(
        "author" => array(
            "name" =>"NAME",
            "url" => "WEB_URL",
            "icon_url" => "ICON_URL"
        ),
        "title" => "Title",
        "url" => "WEB_URL",
        "description" => "Text message. You can use Markdown here. *Italic* **bold** __underline__ ~~strikeout~~ [hyperlink](https://google.com) `code`",
        "color" => 15258703,
        "fields" => array(
            array(
                "name" => "Text",
                "value" => "More text",
                "inline" => true
            ),
            array(
                "name" => "Text",
                "value" => "More text",
                "inline" => true
            ),
            array(
                "name" => "Even more text",
                "value" => "Yup",
                "inline" => true
            ),
            array(
                "name" => "Use `\"inline\" => true` parameter, if you want to display fields in the same line.",
                "value" => "okay..."
            ),
            array(
                "name" => "Thanks!",
                "value" => "You're welcome :wink:"
            )
        ),
        "thumbnail" => array(
            "url" => "THUMBNAIL_URL"
        ),
        "image" => array(
            "url" => "IMAGE_URL"
        ),
          "footer" => array(
            "text" => "Woah! So cool! :smirk:",
            "icon_url" => "ICON_URL"
        )
    );


    $client->setAvatar('AVATAR_URL'); // Optional
    $client->setUsername('BOT_NAME'); // Optional
    $client->setMessage('MESSAGE');
    $client->setEmbedData($embedData); //Optional
    $client->send();
}catch(\DiscordWebhooksPHP\DiscordException $e) {
    echo 'Error:'.$e->getMessage().'--'.$e->getCode();
    exit;
}

Contributing

Pull requests and issues are open!

统计信息

  • 总下载量: 1k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 2
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 1
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: Unlicense
  • 更新时间: 2018-12-21