Download the PHP package commandstring/dphp-bot without Composer
On this page you can find all versions of the php package commandstring/dphp-bot. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download commandstring/dphp-bot
More information about commandstring/dphp-bot
Files in commandstring/dphp-bot
Package dphp-bot
Short Description An unofficial way to structure a DPHP Bot
License MIT
Informations about the package dphp-bot
DiscordPHP Bot Template
An unofficial way to structure a discordPHP bot.
Table of Contents
- Installation
- Important Resources
- Configuration
- Slash Commands
- Events
- Disabling Commands and Events
- Extending The Template
- Bootstrap Sequence
- Environment Variables
Installation
Important Resources
DiscordPHP Discord Server Only ask questions relevant to DiscordPHP's own wrapper, not on how to use this.
Developer Hub Issues about this template can be asked here
Configuration
Copy the .env.example
file to .env
and add your bot token.
Slash Commands
Create a class that implements Core\Commands\CommandHandler
and attach the Core\Commands\Command
attribute to it.
Once you start the bot, it will automatically register the command with Discord. And if you make any changes to the config, it will update the command on the fly.
Events
Create a class that implements any of the interfaces found inside of Core\Events
.
Implement the interface that matches your desired event.
If the interface doesn't exist use the Class Reference. Just create a interface that has a handle methods with args that match up with the ones in the event. Then sit it inside /Core/Events
Disabling Commands and Events
If you want to disable a command handler or event listener attach the Core\Commands\Disabled
attribute to it.
Extending The Template
Bootstrap Sequence
Create a file inside /Bootstrap
and then require it inside of /Boostrap/Requires.php
.
Environment Variables
Add a doc comment to /Core/Env.php
and then add the variable to .env
You should also add it to .env.example
All versions of dphp-bot with dependencies
commandstring/utils Version ^1.7
react/async Version ^4.1
team-reflex/discord-php Version dev-master
tnapf/env Version ^1.1