Discord Raffle Bot [0.2]
The Discord Raffle Bot is, as the name suggests, a simple python bot for hosting real time raffles for talk shows, communities, livestreams and others. This simple bot allows for flexibility while utilizing just a single command to ensure simplicity for non-tech savvy users.
People experienced in the Python programming language will also be able to easily expand on the bot, add new functionalities and commands thanks to an easy and simple code design that welcomes even the beginners.
This bot utilizes just Python 3.6 (should work on 3.0 and newer, but was tested on 3.6) and the discord.py Python library.
The bot is heavily dependent on the asyncio library (installed by default) which allows Python to act as an asynchronous programming language. This ensures that the bot can be run on multiple discord servers and in multiple channels at once without stopping raffles already taking place and without hosting multiple instances of the bot.
Changes & New Functionalities
Added a config.py file & ability to exclude a role from the raffle.
Defining the broadcaster and people excluded from the raffle is easier than ever before!
Just drop the role name into one of those two lists in the
The max and min time for the raffle's run time can be defined just as easily.
The messages have also been moved to the config file since they are intended to be editable.
Removed legacy function based code and wrote shorter, clearer code based on a Raffle class.
The functions proved to not be very clear and hardly readable. Their usage was also questionable at times, as some functionality could've been moved to other functions for clarity and/or performance reasons.
This also allows for more than 1 instance of a raffle to run at once!
Rewrote code to abide by the pep8 guidelines.
I was advised to do this by the moderator checking my post last time, so I looked into it and adjusted my code to make it clearer and follow those rules.
Line breaks, line breaks everywhere!
The code now follows the 80 char limit and switched from tabs to spaces.
Updated the README.md file to reflect the changes.
Due to the addition of config.py, the instructions for setup changed slightly (for better!).
- Fixed a bug where if there were no participants, the bot would crash.
- Fixed a bug where the last participant would've been excluded from the raffle.
- Fixed a bug where the bot could pick itself if it wasn't assigned the permitted role.
- Fixed a bug where messages from above the start of the raffle could be selected.
- Fixed a bug where sometimes last raffle's participants would take part in the next one.
The project is finished aside from final polish and addition of good suggestions. It will also remain maintained for bugs if any are found.
How to contribute?
If you wish to contribute to this project, please use the Github Issues or create Pull Requests directly. You can also contact me via comments under this post.