Skip to content

Misanth420/Prometheus

Repository files navigation

Prometheus_MetaGame Details

This repository was made with the MetaGame DAO discord server in mind specifically, for sourcecred. However it has expanded a bit beyond the initial first command. The repo is messy and expect junk code here and there but the functionalities are working

Overview

This repository contains an open source discord bot built with Python that uses discord.py, python-dotenv, venv, peewee and colorama.
At the time of this writing: The bot offers community owned moderation tools that include ban polls, automatic ban reversal polls, a contribution report mechanism, an anonymous polling command and a database.
The bot allows the community to act without a moderator, allows for ban redemption and moderator checking, and allows for anonymous polling where the results and votes aren't visible until the vote ends.

Usage

The bot is designed to be used in Discord servers as a community moderation and contribution tool. Once the bot is installed and running, it can be used to initiate ban polls, automatic ban reversal polls, and anonymous polls. It can also be used to query and report on contributions in different domains.

Setup

  1. Create a logs folder in the root directory. This is needed since error logging is included. Optional if logging is removed from main.py.
  2. Create a .env file from a copy of .env.sample.
  3. Fill out the .env file with your discord bot token. Check below for instructions on how to get the token if you don't have one.
  4. Setup the virtual environment following the instructions on Discord.py Docs
  5. Run the ./main.py script to start the bot.

Discord Bot Token

It is important to note the Bot requires the following intents enabled in the Discord's developers portal:

  1. Presence Intent
  2. Server Members Intent
  3. Message Content Intent

Registering the bot and getting the token

  1. Navigate to https://discord.com/developers/applications and login
  2. Create a new application by clicking the button in the top right New Application
  3. Fill out general info and navigate to the Bot tab on the right hand side
  4. Name your bot and fill out info
  5. Make sure you leave OAUTH2 CODE GRANT disabled
  6. Enable intents listed above and save
  7. Navigate to the OAuth2 - URL GENERATOR on the right hand side
  8. For SCOPES pick bot and for BOT PERMISSIONS pick Administrator. It is usually recommended to pick exact permissions if full admin isn't needed. Caution
  9. URL should be generated on the bottom. That is your bot invite link. Use it to invite your newly created bot to the server
  10. Back in the Bot tab, click on Reset Token to generate your Discord Bot token and store it securely. This token should be placed in the bots .env file you'll create during setup.

Additionally:

  1. Prefix can be changed by running the !set_prefix x command. Default is '!'
  2. Check the settings for required roles and other id related stuff.
  3. Goes without saying but, the bot isn't hosted anywhere. I am running my instance from my local machine so if forked, keep that in mind.

Ban Polls

The ban poll command allows the community to vote on whether a user should be banned from the server. The poll can be initiated by any user with the appropriate permissions, and the results are announced once the poll ends. To initiate a ban poll, use the /banpoll command followed by the user's name and the description(reason) for the poll.

Automatic Ban Reversal Polls

The automatic ban reversal poll command allows the community to vote on whether a user's ban should be reversed. If a user was banned by a moderator and not by the bot as a result of a ban poll, an automatic ban reversal poll will be initiated. The results are announced once the poll ends and depending on the results, unbans the user or does nothing. Currently, the poll duration is set to one day. See config

Contribution Report Menu

The contribution report mechanism allows the community to report contributions they made. The report can be initiated by any user with the appropriate permissions by selecting the appropriate choices, adding a description with artefact and clicking submit. The results are parsed and reposted in a destination channel, tagging the user. There's a directory \img with stable diffusion generated images that are randomly picked for the reports and a \utils\lexicon.py file with random descriptions and titles used in the reports. Those reports that are submitted get recorded in the bot's database and can be fetched with commands.
To create a report menu, write !prepare #destination-channel. This should send the menu to the tagged channel and you can start using it. Check Database section below for db related commands. 👇👇👇\

Anonymous Voting

The simple anonymous polling command allows the community to vote on an issue without their votes being visible until the poll ends. The poll can be initiated by any user with the appropriate permissions, and the results are announced once the poll ends.
To initiate an anonymous poll, use the /gvote slash command, add a number of minutes and a description for the vote. For example /gvote 60 should we buy the constitution? will create a poll that will run for 60 minutes with the question "should we buy the constitution?"

Database

The bot uses a local sqlite database to store information on polls and contribution reports. The database can be accessed using the appropriate commands in the bot:
!reportstats will return the current number of reports for the guild, listed by category
!reportstats @user will return the same as above just for a specific user
!getcsv @user will return a csv of the user to download.

Technical Details

The bot uses discord.py to communicate with Discord servers, python-dotenv to manage environment variables, venv to manage the virtual environment, peewee to manage the database and colorama to print messages in color. The bot requires Python 3.8+. The current database is a local sqlite database. There are plans to migrate to postgres in the future.

Special thanks

A special thanks to the following individuals for their contributions, whether in the form of feedback or otherwise:\

@Musashi13 - thanks for testing everytime i pinged you 🤣 and for the ideas! Example Screenshot

@CamilaArias - thanks for the feedback, feature suggestions and showing me how to merge! \

@polimyl - thanks for setting me on this path in the first place by suggesting to go with python! 🙌 \

@richardschwabe - randomly encountered your discord.py tutorials when I started my bot journey so I feel like I should mention it here, the youtube tutorial series helped a lot, so even though we haven't spoken and I don't know you, thanks!

License

The bot is open source and available under the GPLv3 license.

About

A discord.py bot with a few community tools

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages