Package: polling-bot
polling-botpolling-bot is a Discord bot to conduct basic polling functions in a Discord serverOverviewOften times, reaching a consensus can be difficult without an organized method in place, and so this polling bot can be added to a Discord
server to solve that need in a simple and efficient manner. Use cases could include deciding with friends on a place to eat, what video game
should be played, when to schedule a party, etc.The bot supports starting a poll and adding options for choices by the users. It will then keep track of responses made to the poll, and surface the winner of the poll when called upon.DetailsThis project is a pure python project using modern tooling. It uses aMakefileas a command registry, with the following commands:make: list available commandsmake develop: install and build this library and its dependencies usingpipmake build: build the library usingsetuptoolsmake lint: perform static analysis of this library withflake8andblackmake format: autoformat this library usingblackmake annotate: run type checking usingmypymake test: run automated tests withpytestmake coverage: run automated tests withpytestand collect coverage informationmake dist: package library for distributionSetupTo setup the Discord bot, follow the steps below:Navigate tohttp://discordapp.com/developers/applicationsand create an account, or login if you already have a Discord account.Select "New Application" and give it a name ie. "polling-bot"Navigate to the Bot tab on the left side menu, and click "Add Bot" and confirm.Under the TOKEN section, click "Copy" and copy the token.To add the bot to your Discord server, select the OAuth2 tab from the left side menu. From the SCOPES section, select bot option and from the BOT PERMISSIONS section, select Administrator. Copy and navigate to the generated URL and select the server you want to add the bot to from the dropdown, then click "Authorize."Next, install polling-bot with pip:pip install polling-bot.Finally, to run the bot, import and run it as follows:importdiscordpollingbot=__import__("polling-bot")bot=pollingbot.PollingBot(intents=discord.Intents.all(),command_prefix="/")bot.run('TOKEN')Where token is the token copied from the Developer Portal above.The bot will now be responsive to commands in your Discord server.Available Commands/poll- Starts a poll in the server/add choice <content>- Add choices to the poll/edit <option> <content>- Edit the content of the pollOptions are 'name', 'description', 'choice', and 'duration' (to alter how long the poll is open for [default is 5 mins])/vote <choice #>- Vote for a choice in the pollChoice # is the # corresponding to the desired choice, viewable with/view choicesor/view poll/view <option>- View the contents and results of the pollOptions are 'name', 'description', 'choices', 'poll', and 'results'UsageStart by executing/pollto create a poll. Edit the name and description of the poll using the/editcommand. Next, add choices to the poll using the/addcommand. Have users then vote on the choices by running/view pollto see the current state of the poll, and then voting on their desired selection using the/votecommand. Once all users have voted and the poll has concluded, run/view resultsto view the results and winner of the poll.