Download the PHP package itstautvydas/modular-discord-php without Composer
On this page you can find all versions of the php package itstautvydas/modular-discord-php. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download itstautvydas/modular-discord-php
More information about itstautvydas/modular-discord-php
Files in itstautvydas/modular-discord-php
Package modular-discord-php
Short Description An extension for DiscordPHP
License MIT
Informations about the package modular-discord-php
ModularDiscordPHP
[]()
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
Basic usage
You can view the full example in here.
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