This is the repository for the chat bot of the TU Wien Data Science Discord server.
The bot connects to Discord via discord.py and parses messages with snips. Every message that is sent on the server is passed to message handlers defined in handlers/
. These message handlers decide if they want to respond to the given message themselves. In addition to the message the intent (extracted with snips) is also passed to each handler. Intents are defined in nlu-dataset.yml
and may be extended.
For more info on intents, see snips documentation.
If you'd like to run the bot e.g. on your own server for testing purposes you need your own API token.
# make api token available in environment
export DISCORD_API_TOKEN="<your-token>"
# make the script executable
chmod +x run.sh
# run the bot
./run.sh
There are a few ways you can contribute
Difficulty: easy
In nlu-dataset.yaml
you will find the types of phrases the bot will be able to detect (called intents) and respond to. You can add more examples for each intent by just adding another bullet point. This will make the bot respond to a wider variety of phrases. Here is the documentation on the format of the file.
You can also add more responses. The responses can be found inside the message handlers themselves.
Difficulty: medium
In the directory handler/
you will find different types of message handlers or actions of the bot. Each of them will do different things and respond to different intents. For example handlers/english_only.py
will respond to messages that are German and remind people to keep the chat English.
To create a new message handler inherit from the class MessageHandler
in handlers/handler.py
.
Difficulty: hard
If you want to do something that the current architecture doesn't support, create an issue on how you would like to improve it before you write a lot of code.