Discord Issue Bot
A discord bot for creating github repo issues.
Requires: php-zlib, php-json, mysql, composer
Tested on: Ubuntu 20.04.3, PHP Version 7.4.3, ZLib Version 1.2.11, MySQL Version 8.0.27
Download the repo then run:
composer require team-reflex/discord-php
Edit the file bot.php and set the config values:
//Config
$db_server = "localhost";
$db_user = "";
$db_pass = "";
$dbname = "";
$discord_token = "";
$git_token = "";
$git_user = "";
$superadmin = ""; //discord id of the main admin account (cannot be removed by others using the .remove command)
//Config
Only users that have been added using the .add command may use the bot. The user set as superadmin in the config always has access.
New issue titles and bodies must be wrapped in double quotes and must not contain double quotes (replace them with anything else).
How to find your discord id: https://support.discord.com/hc/en-us/articles/206346498-Where-can-I-find-my-User-Server-Message-ID-
How to acquire a discord token and add your bot to your server(s): https://discordpy.readthedocs.io/en/stable/discord.html
Recommended bot permissions: Read Messages/View Channels, Send messages, Read Message History
Run the bot from a command line:
php bot.php
I recommend running the bot using a linux screen, I have included a shell script which can be used via cron to keep the bot running. You will need to modify the path used on line 4 of dib.sh.
Usage
The available commands are:
.help
.add @username
.issue "git repo name" "New Issue Title" "New Issue Body"
Or reply to any message to use its content as the body of the new git issue:
.issue "git repo name" "New Issue Title"
.listusers
.remove @username