Discord Raffle Bot - Update 0.2

in #utopian-io6 years ago (edited)

Discord Raffle Bot [0.2]

Repository

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.

Technology Stack

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

The changes since the last post can be found between the commit 08dfd1a and 9e30b5c.

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 config.py file.

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!).

Bug Fixes

  • 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.

Roadmap

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.

Special thanks to @mys and @emrebeyler for great feedback!

My Github Account

Sort:  
Loading...

Congratulations! Your post has been selected as a daily Steemit truffle! It is listed on rank 19 of all contributions awarded today. You can find the TOP DAILY TRUFFLE PICKS HERE.

I upvoted your contribution because to my mind your post is at least 14 SBD worth and should receive 46 votes. It's now up to the lovely Steemit community to make this come true.

I am TrufflePig, an Artificial Intelligence Bot that helps minnows and content curators using Machine Learning. If you are curious how I select content, you can find an explanation here!

Have a nice day and sincerely yours,
trufflepig
TrufflePig

Hey @jestemkioskiem
Thanks for contributing on Utopian.
We’re already looking forward to your next contribution!

Contributing on Utopian
Learn how to contribute on our website or by watching this tutorial on Youtube.

Want to chat? Join us on Discord https://discord.gg/h52nFrV.

Vote for Utopian Witness!

Congratulations @jestemkioskiem! You have completed some achievement on Steemit and have been rewarded with new badge(s) :

Award for the number of comments

Click on the badge to view your Board of Honor.
If you no longer want to receive notifications, reply to this comment with the word STOP

Do not miss the last post from @steemitboard!


Participate in the SteemitBoard World Cup Contest!
Collect World Cup badges and win free SBD
Support the Gold Sponsors of the contest: @good-karma and @lukestokes


Do you like SteemitBoard's project? Then Vote for its witness and get one more award!

Coin Marketplace

STEEM 0.35
TRX 0.12
JST 0.040
BTC 70601.11
ETH 3576.21
USDT 1.00
SBD 4.78