承接 valgorithms/discord-php-eventlogger 相关项目开发

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

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

valgorithms/discord-php-eventlogger

Composer 安装命令:

composer require valgorithms/discord-php-eventlogger

包简介

DiscordPHP EventLogger is a tool designed to generate guild specific logs for the DiscordPHP API Library.

README 文档

README

DiscordPHP EventLogger is a tool designed to generate user logs for the DiscordPHP API Library. It logs various events such as member joins/leaves, message deletions, role updates, and more.

Features

  • Logs member joins and leaves
  • Logs message deletions and updates
  • Logs role creations, deletions, and updates
  • Logs channel creations, deletions, and updates
  • Logs bans and unbans

Installation

To install the DiscordPHP EventLogger, you need to have Composer installed. Run the following command:

composer require valgorithms/discord-php-eventlogger

Usage

Configuration

Set the DISCORDPHP_EVENTLOGGER_GUILD_CHANNELS environment variable to specify the guilds and their respective log channels. The value should be a comma-separated string where each entry is a guild-channel pair separated by a hyphen.

Example:

DISCORDPHP_EVENTLOGGER_GUILD_CHANNELS=1077144430588469349-1077144432463314998,1253459964849164328-1253480680583860367

Example

Here is an example of how to use the EventLogger in your project:

require 'vendor/autoload.php';

use Discord\Discord;
use EventLogger\EventLogger;

$discord = new Discord([
    'token' => 'YOUR_DISCORD_BOT_TOKEN',
]);

$events = [
    'CHANNEL_CREATE',
    'CHANNEL_DELETE',
    'CHANNEL_UPDATE',
    'GUILD_BAN_ADD',
    'GUILD_BAN_REMOVE',
    'GUILD_MEMBER_ADD',
    'GUILD_MEMBER_REMOVE',
    'GUILD_MEMBER_UPDATE',
    'MESSAGE_DELETE',
    'GUILD_ROLE_CREATE',
    'GUILD_ROLE_DELETE',
    'GUILD_ROLE_UPDATE',
];

$eventLogger = new EventLogger($discord, $events);

$discord->run();

Custom Events

You can add custom events by modifying the createDefaultEventListeners method in the EventLoggerTrait trait.

private function createDefaultEventListeners(array $events = []): void
{
    // Add your custom event listeners here
}

License

This project is licensed under the MIT License. See the LICENSE file for details.

Credits

DiscordPHP EventLogger by Valithor Obsidion

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2024-12-19