Git Product home page Git Product logo

discordreportbot's Introduction

discordReportBot

This is a very shitty report bot that I threw together in a couple of days of my free time. Please don't actually use this. It's for a Discord server that is big enough to have a report bot because we outgrew Google Forms, but is not nearly big enough to invest the time or money into making a fully featured bot that isn't a mess. Anyone's free to use it because I really don't give a fuck, but please don't message me when it breaks. I'll probably update it for our needs.

Roadmap:

  • Attachment support
  • Toggles for enabling attachments, dedicated report channel, and other things
  • Toggle attachment support on a question by question basis
  • Run checks on attachments
  • Put all sent messages in config.yaml

Prerequisite stuff

  • Create Discord Application

I don't really want to host this for more people than me, so you'll need to create your own Discord application and use this python app to run it. This is a good tutorial on how to make a discord app.

  • Enable Bot Permissions

You'll need to enable both "Server Members Intent" and "Message Content Intent" Privileged Gateway Intents in the application editor menu on the Bot subheader. Don't forget to save your changes!

  • Invite the bot to your server

You'll need to generate a link to invite the bot to a guild (server). For this, I would recommend following the tutorial and being absolutely certain that the bot doesn't have more permissions than it needs. This is to prevent someone from stealing your bot key and using it to destroy your server. With that said, the bot needs the following permissions: firefox_VqgEdnUTdl firefox_DulRGZzQ69

Note: You will need to manually give the bot permissions to the channels you want it to look for the command in and where you want it to output the completed reports. It also needs permissions to send notification to the role you wish.

Install

  • Get programs

-Ubuntu/Debian

sudo apt-get update
sudo apt-get install -y python3 python3-pip git 

-Windows 10/11 Chocholatey

Open an Administrator Command Prompt

choco install python3 git
  • Clone Repository

git clone https://github.com/WTCB420/discordReportBot.git
cd discordReportBot
  • Install Requirements

Note: while not strictly nessicary, it is advisable to create a virtual enviorment to install all packages. See this reference for more information on setting one up.

python3 -m pip install -r requirements.txt
  • Create and populate .env file

Ubuntu/Debian

nano .env

Add the following text to the file, removing the (ENTER TOKEN HERE) with your actual token.

DISCORD_BOT_TOKEN = "(ENTER TOKEN HERE)"

Press CTRL + O then RETURN then CTRL + X Windows 10/11

notepad.exe .env

Add the following text to the file, removing the (ENTER TOKEN HERE) with your actual token.

DISCORD_BOT_TOKEN = "(ENTER TOKEN HERE)"

Press CTRL + S and close the file

  • Run

Note: If you chose to set up a virtual environment, you will need to replace python3 with the path to the local python executable. E.g. ~/venv/Scripts/python3.exe

python3 main.py

Configure

This is the part where you change the default config.yaml so the bot will function properly.

This is the key that is entered before the report command. Eg. !report where the ! is the prefix

prefix: "!"

This key defines what word following the prefix will trigger the bot's logic. E.g. !report, where report is the command

command: "report"

This key defines where the bot should listen for the command. This needs to be a number (integer). E.g., 800836208007446528 could point to #bot-stuff. Leaving this at zero will use default values and may break the bot.

Note: You can find the ID of the channels or groups with this tutorial.

commandChannel: 0

This key defines where the bot should post the information provided in a completed report. This needs to be a number (integer). E.g. 818260076291817521 could point to #completed-reports. Leaving this at zero will use default values and may break the bot.

reportChannel: 0

This key handles what role the bot should mention when a report is completed. E.g. 1227702564880126114 could be for @admin. Leaving at 0 will disable mentions.

role_id: 0

This is the amount of time, in seconds, the bot should wait before ending an inactive report instance. 3600 seconds = 1 hour

messageTimeout: 3600

This section contains the messages that will be sent to the person who opens a report. It will send all the messages under the 'messages' parent key, no matter their key (as long as they follow json syntax and have a unique key).

messages:
  username: "What is the username of the person who you are reporting?"
  issueMessage: "Being as detailed as possible, what issue are you facing?"
  userSolvedStateMessage: "How would you like the issue to be resolved?"
  reachOutMessage: "Would you like us to contact you for further information?"

If you wanted, for example, to add an option to ask the user what rule they think the offender broke, you could add the following.

messages:
  username: "What is the username of the person who you are reporting?"
  issueMessage: "Being as detailed as possible, what issue are you facing?"
  ruleBrokenMessage: "What rule do you think they broke?"
  userSolvedStateMessage: "How would you like the issue to be resolved?"
  reachOutMessage: "Would you like us to contact you for further information?"

And that about wraps up everything to configure. If you have any questions, feel free to reach out, bearing in mind that I'm not a professional dev and this is a free bot.

discordreportbot's People

Contributors

wtcb420 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.