This video explains how to create a bot and obtain a token.
You need to:
- Visit https://discord.com/developers/applications/
- Select "New application" (top right corner)
- Give your bot a name. Our naming convention in bzzz is that all bots have a name that starts with
BOT_. For exampleBOT_Pi_1. Choose a unique name for your bot. - In the left sidebar, go to "bot" and make sure that all options under "Privileged Gateway Intents" are active. Don't touch anything else.
To get the token of your bot select "Reset Token". Then the token will be reset and revealed. Copy the token and paste it into a file named token.private in this folder (you need to create the file). Each agent (each Raspberry Pi) will have a unique token.
The next step is to invite your bot to the server.
To invite your bot, follow these steps
- Ask @alphaville, @jamie-54 or any other member for an invitation to the Discord server and accept it. Ask @alphaville for admin privileges
- Visit https://discord.com/developers/applications
- Select your bot
- Go to "OAuth2" and then "URL Generator"
- From the list of scopes, select "bot"
- From the list below select "Manage Roles", "Manage Channels", "Read messages/view channels", "Send messages", "Manage messages", "Embed links", "Attach files", "Read message history", "Use slash commands", "Connect" and "Speak"
- Copy the link from below
- Follow the link to invite your bot to the server
To run the client, first you need to create a virtual environment with Python 3 (we have tested this with Python 3.11.2):
python -m venv venv_bot
For older versions of Python a virtual environment can be created by (we have tested this with Python 3.9):
virtualenv -p python3 venv_bot
Then, activate the virtual environment
source venv_bot/bin/activate
and install the following packages
pip install discord.py
pip install netifaces
Then, just run the script
cd bzzz/raspberry/DiscordBot
python main.py
After the virtual environment and dependencies have been installed as described above, a script can be used to automatically run the client on start_up.
To do this, the run_DiscordBot_on_start_up.sh can be added to the user's crontab by:
crontab -e
Then add the following:
@reboot sleep 10 && ~/bzzz/raspberry/DiscordBot/run_DiscordBot_on_start_up.sh
Firstly, you need to join our private Discord server. Ask one of the team members for an invitation.
In the list of participants you can see which agents (bots) are live. Type .ip1 to get their IPs. To format the output using markdown, use .ip p (here 'p' stands for 'pretty')
Footnotes
-
It is not case-sensitive, so
.IPworks as well ↩