valgorithms / pzbot
该包的最新版本(dev-master)没有可用的许可信息。
Valgorithm的官方Discord机器人,使用ReactPHP构建。
dev-master
2024-05-17 16:58 UTC
Requires
- php: ^8.0.0
- clue/redis-react: ^2.6
- react/async: 4.x-dev
- react/child-process: 0.6.4
- react/filesystem: ^0.2@dev
- team-reflex/discord-php: dev-master
- wyrihaximus/react-cache-redis: ^4.2.0
Suggests
- ext-event: For a faster, and more performant loop
- ext-libev: For a faster, and more performant loop
- ext-mbstring: For accurate calculations of string length when handling non-english characters.
- ext-uv: For a faster, and more performant loop. PHP >=7 only. Preferred.
- vzgcoders/twitchphp: For integration with Twitch chat.
This package is auto-updated.
Last update: 2024-09-17 17:40:52 UTC
README
这是一个用于DiscordPHP的PZ机器人类。它通过PHP提供与Discord交互的功能。
安装
开始之前,请确保您的机器上已安装PHP。此机器人类需要PHP CLI运行。
- 将此仓库克隆到本地机器。
- 导航到项目目录。
- 安装所需的依赖项。此项目需要
Monolog
库进行日志记录和BigInt
扩展进行大整数运算。如果您使用Composer,可以通过运行composer install
来安装这些依赖项。
用法
要使用PZ机器人类,您需要创建类的实例并将选项数组传递给构造函数。选项数组应包括以下键
discordToken
:您的Discord机器人令牌。clientId
:您的Discord客户端ID。clientSecret
:您的Discord客户端密钥。guild_id
:机器人连接到的公会(服务器)的ID。channel_ids
:将频道名称映射到其ID的关联数组。role_ids
:将角色名称映射到其ID的关联数组。loop
:ReactPHP事件循环的实例。discord
:DiscordPHP客户端的实例。rcon
:RCON客户端的实例。
以下是如何使用PZ机器人类的示例
$options = [ 'discordToken' => 'your_discord_token', 'clientId' => 'your_client_id', 'clientSecret' => 'your_client_secret', 'guild_id' => 'your_guild_id', 'channel_ids' => [ 'pz-players' => 'channel_id', // Channel name will automatically update with the # of players // Add more channels as needed ], 'role_ids' => [ 'role_name' => 'role_id', // Add more roles as needed ], 'loop' => $loop, 'discord' => $discord, 'rcon' => $rcon, ]; $bot = new PZ\BOT($options); $bot->run();
将'your_discord_token'、'your_client_id'、'your_client_secret'、'your_guild_id'、'channel_name'、'channel_id'、'role_name'、'role_id'、$loop、$discord和$rcon替换为您实际的值。您可能需要根据您的实际项目设置和需求调整安装和用法说明。
贡献
欢迎贡献!请提交包含任何增强、错误修复或其他贡献的拉取请求。
许可
此项目采用MIT许可证。有关详细信息,请参阅LICENSE文件。