Food Flex is bot that manages:
- Submissions
- Voting
- Results
- Leaderboard
When a user uploads a picture of their food to the chat, they are automatically entered into the competition. Users can only submit once. Additional photos will overwrite the existing submission so your last photo sent will be the one saved.
Submissions are closed and a voting poll is displayed. Users can vote for their favourite by sending the letter that corresponds to the user. Users can only vote once, and not for themselves. The bot will won't count additional votes. Also, anyone who submitted, and hasn't voted by 21:00, will received a private message to remind them to vote. You will receive a private message to confirm your vote.
NOTE: If you submit a picture and don't vote, you are disqualified.
Voting is closed and a results message will be sent to the chat.
This is a read-only channel that updates every day once there are new results. This shows the overall scores over a period of time. This can be a month, university term, or a year. You can also see the leaderboard at here.
See the wiki for documentation on commands, json data and more.
Go into the bot
folder
Install dependencies:
virtualenv .venv
source .venv/bin/activate
pip install -r requirements.txt
To run:
python app/bot.py
The Compose can also be used to run the application.
cp example.env .env
- Configure the variables as equivilent to config *
- Pull:
docker-compose pull
- Launch:
docker-compose up -d
- View logs:
docker-compose logs -f
Will out the .env
file.
TOKEN=
SERVER_ID=
COMMAND_PREFIX=
ADMIN_IDS=
MAIN_CHANNEL_ID=
LEADERBOARD_CHANNEL_ID=
DATA_ROOT=
* The only thing to note here is that admin_id
should be in the form of 1111, 2222, 3333
when using environment variables.
token
- your bot's secret tokenserver_id
- the ID of your servercommand_prefix
- a prefix that marks the message as a command for the bot (you may need a space at the end)admin_ids
- a list of user IDs that will be allowed to use bot commandsmain_channel_id
- the ID of the channel to use for submissions, voting and resultsleaderboard_channel_id
- the ID of the channel to use for the leaderboarddata_root
- directory containingleaderboard.json
andstate.json
(Default value of.
if none is provided)
This guide will show you how to create a Discord Bot for your Discord server.
Go to Discord and turn on Developer Mode. With this, you can now right-click on guilds, channels, catergories, users, messages, etc. and get their ID (an integer).
- Will Russell: Submissions, voting, results, leaderboard, working with the discord.py API wrapper and Discord servers.
- Daniel Spencer: Voting validation, improved reliability, general refactoring, and performance improvements with dictionaries.
MIT License for all the code written by Will and Dan.
DejaVuSans font - Bitstream Vera Fonts Copyright