承接 mistynetwork/discordwebhookapi 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

mistynetwork/discordwebhookapi

Composer 安装命令:

composer require mistynetwork/discordwebhookapi

包简介

Simple discord webhook virion for PocketMine-MP

README 文档

README

DiscordWebhookAPI is an asynchronous PocketMine-MP library that allows sending messages and embeds to Discord using webhooks easily. It uses the libasynCurl library for handling asynchronous requests.

📌 API Registration

Before using the API, it's important to register the class to avoid conflicts with other plugins. If you do not check for registration, it will throw an exception.

use reacherurmom\discordwebhookapi\DiscordWebhookAPI;
use pocketmine\plugin\PluginBase;

class MyMain extends PluginBase {

    protected function onEnable() : void {
        if (!DiscordWebhookAPI::isRegistered()) {
            DiscordWebhookAPI::register($this);
        }
    }
}

📜 Using Messages and Embeds

📌 Creating a Message

use reacherurmom\discordwebhookapi\Message;

$message = Message::create()
    ->setUsername("ReacherUrMom Bot")
    ->setAvatar("https://example.com/avatar.png")
    ->setContent("Hi! This is my bot");

📌 Adding an Embed

use reacherurmom\discordwebhookapi\Embed;

$embed = Embed::create("Embed Title")
    ->setDescription("This is an embedded message.")
    ->setColor(hexdec('ffffff'));

$message->addEmbed($embed);

📌 Embed Methods

use reacherurmom\discordwebhookapi\component\Footer;
use reacherurmom\discordwebhookapi\component\Author;
use reacherurmom\discordwebhookapi\component\Field;

$embed->setFooter(Footer::create("Footer Text", "https://example.com/footer.png"))
      ->setAuthor(Author::create("Author Name", "https://example.com/author.png"))
      ->setTimestamp(new \DateTime('now')->setTimezone('UTC'))
      ->setThumbnail("https://example.com/thumbnail.png")
      ->addField(Field::create("Field 1", "Value of field 1", true))
      ->addField(Field::create("Field 2", "Value of field 2", false));

🚀 Sending the Message

use reacherurmom\discordwebhookapi\DiscordWebhookAPI;

$webhook = "your_webhook_url";
DiscordWebhookAPI::create($webhook, $message)->send();

🙌 Credits

📦 Adding the API to Your Project

You can install this API using Composer:

composer require mistynetwork/discordwebhookapi

📜 License

This project is free to use. For more details, check the LICENSE.

统计信息

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

GitHub 信息

  • Stars: 4
  • Watchers: 0
  • Forks: 2
  • 开发语言: PHP

其他信息

  • 授权协议: proprietary
  • 更新时间: 2025-05-28

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固