- Python 3.5.3+
- Discord.py
- requests
- Pydle
- profanity-check
This is a rewrite of the calculated.gg bot from SaltieRL. This bot provides functionality such as checking ranks and getting some basic stats. It provides connectors to use IRC or Discord.
A couple changes are made in the logic of the bot to reduce code redundancy over the existing bot. The core functionality of the bot revolves around two core classes. Command
and Connector
.
Command is a template class that has the following attributes you can set:
requiredArgs
: the number of arguments required for the command. -1 will allow any number of arguments (so that your function can determine what to do)helpMessage
: the message to be displayed when a user runs help command-nameaction
: the method that will be run if the command was used with the correct number of args.
Connector
is a template for how connections should be established. It requires several functions defined to work.
message_received(sender, channel, message)
: this is used to parse messages and execute commandsconnector_run()
: this should start the connector.send_message(sender, channel, message)
: this should send a message to the target platform
The Message
class is essentially a wrapper for Discord.Embed. It is used as a compatibility layer to provide nicer formatting for platforms that support it.
- Make sure you have Python 3.5.3 and pip
apt update
apt install python3 python3-pip
- Install necessary Python dependencies.
apt install python3-requests
pip3 install discord pydle profanity-check
- Clone Calculated.gg-bot
git clone https://github.com/Skyl3r/Calculated.gg-bot
- Review
irc_example.py
ordiscord_example.py
to create your run script. Then launch by running:
python3 irc_example.py # Or discord_example.py
Windows (With Chocolatey)
- Make sure you have Python 3.5.3+, pip and git.
choco install python3 pip git -y
- Install necessary python dependencies. If you did not have python or pip, you will need to restart command prompt.
pip install discord pydle profanity-check requests
- Clone Calculated.gg-bot. CD to a directory you would like to run Calculated.gg-bot from and use git clone to clone the repository.
git clone https://github.com/Skyl3r/Calculated.gg-bot
- Review
irc_example.py
ordiscord_example.py
to create your run script. Then launch by running:
python3 irc_example.py