itstautvydas/modular-discord-php 问题修复 & 功能扩展

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

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

itstautvydas/modular-discord-php

最新稳定版本:v1.0.2

Composer 安装命令:

composer require itstautvydas/modular-discord-php

包简介

An extension for DiscordPHP

README 文档

README

Status License

This is an extension for DiscordPHP which allows user to make modules that could control listeners or commands and this makes the code more organized. I have made something like this long ago but I just wanted to rewrite it because the code was horrible.

I made this so I could make bots easier and so I decided to public it.

Features

  • Console/terminal support - an ability to run commands (and register your own ones) through console! For now Windows are not supported! Not sure about other systems, I only tested this on Windows and Linux.
  • Modules - the core thingy. They can also be disabled and enabled if needed.
  • Listeners - make listeners be in separate files, define methods instead of calling them.
  • Commands - easily register and listen to commands! Commands are only sent do discord once.
  • Accessors - those so called "accessors" (I couldn't come up with anything better lol) are instances that every module can access. This is useful if you have an instance of one object and you want to access it in multiple modules.
  • Reloadable modules! - you can also completely reload a module, meaning file changes are applied. This basically disabled current module, gets its code, renames the class and loads it again. Sadly, there is no other way of unloading a class in PHP. This might be useful for testing! Note: Other external files don't get reloaded.

TODO

  • Finish console commands

Getting Started

Installing

composer require itstautvydas/modular-discord-php

Basic usage

You can view the full example in here.

include 'vendor/autoload.php';

use Discord\Discord;
use ModularDiscord\ModularDiscord;

ModularDiscord::new()->loadAccessors()->loadModules()->initiateDiscord([
    'token' => '******'
    // Put your bot options here
], function (Discord $discord) {
    // Do something before running discord bot client...
})->run();

About accessors and modules

Accessors do not require to have their own folder, but if they do have, the main file should be called accessor.php with a class name that is the same as folder's name.

Depending on other module is possible but just note that the modules get loaded alphabetically.

Running

Very basic command

php bot.php

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2023-08-19

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固