https://github.com/psecio/dbot
Discord bot platform for PHP
https://github.com/psecio/dbot
bot discord php platform
Last synced: about 1 year ago
JSON representation
Discord bot platform for PHP
- Host: GitHub
- URL: https://github.com/psecio/dbot
- Owner: psecio
- Created: 2017-10-23T21:31:35.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2017-10-24T16:27:37.000Z (over 8 years ago)
- Last Synced: 2025-03-25T12:40:51.370Z (about 1 year ago)
- Topics: bot, discord, php, platform
- Language: PHP
- Size: 6.84 KB
- Stars: 7
- Watchers: 1
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
## DBot: A Discord bot in PHP
The `DBot` library provides a long-running bot process written in PHP.
### Installation
```
git clone git@github.com:psecio/dbot.git
composer install
```
Copy the `.env.dist` file to `.env` and configure it with your bot's token.
### Usage
```
php bin/dbot.php
```
### Adding a Dispatch action
When the Discord API sends a new event on the websocket, your bot will receive the message with a `t` value in the JSON. This is the "dispatch type". Handlers for these can be added to the `bin/dbot.php` script like this for a `GUILD_CREATE`:
```php
addDispatch('GUILD_CREATE', function($json) {
echo 'guild create!!!!'."\n";
return 'test';
});
$bot->init();
?>
```