The bot uses discord.py, an API wrapper for Discord written in Python. Currently, the bot is based on the async branch, but will probably be migrated over to the rewrite branch in the future.
Documentation can be found here.
- Make sure you have installed python3.5+.
- Download or clone the repository.
- Install the following dependencies:
python3 -m pip install -U discord.py[voice]python3 -m pip install -U youtube-dlpython3 -m pip install -U aiohttppython3 -m pip install -U rocket-snakepython3 -m pip install -U gttspython3 -m pip install -U pymongopython3 -m pip install -U python-dateutil
sudo apt-get install ffmpeg
- Create token.txt containing only the bot-token aquired from discordapp.
- Create an asynchronous function using keywords
async def. Remember to useawaitfor all coroutine function calls only.
Example:
@register_command("roll")
async def roll(message, bot_channel, client):
await client.delete_message(message)
try:
options = message.content.split()
rand = randint(int(options[1]), int(options[2]))
await client.send_message(bot_channel, '{}: You rolled {}!'.format(message.author.name, rand))
except:
await client.send_message(bot_channel,
'{}: USAGE: !roll [lowest] [highest]'.format(message.author.name))- Register function by using decorator
@register_command("command name one", "command name two", ect). Command prefix (like '!') must be omitted as this is added automatically.register_commandis found in theutilsmodule. Usefrom utils import register_commandto access it.
Example:
@register_command("ping")
async def ping(message, bot_channel, client):
await client.delete_message(message)
await client.send_message(bot_channel, 'Pong!')