A modular bot for moderating users on discord! Add custom commands and event handlers to customize the bot to your liking. Reload the bot using the builtin !reload
or !reload events
command to see your changes applied LIVE!
This bot will only work for bots that are smaller as it requires the use of message intents, which for larger bots, requires verification from discord. This means if your bot will be in more than 100 severs you will not be able to use this method of doing commands and will need to code your own command handlers using the new interactions.
See this FAQ from discord regarding these changes.
There is a vague plan to update to use the new interaction based commands which offers a nicer user experience, but for now it will remain message based until I really get bored and need something to do
Adding your own commands
Adding your own event handlers
Adding your own persistent storage
python -m pip install discord.py
pip3 install discord.py
Bot
section and click Add a bot
. Fill in the necessary info (like name and an image if you like)Privileged Gateway Intents
section and make sure to select the SERVER MEMBERS INTENT
and MESSAGE CONTENT INTENT
. Click save so it saves your changes!Reset Token
button, follow the screen prompts until you can copy that token. This is how the program will log in as this bot account. DO NOT SHARE THIS TOKEN WITH ANYONE!token.txt
in the same folder as the bot.py
file.OAuth2
section.URL Generator
section on the sidebarbot
scope and then select the Administrator
permission in the newly displayed Bot Permissions checkbox listbot.py
is) and run the command python bot.py
to run the bot.!
<argument>
= Required argument[argument]
= Optional argument1w2d3h4m5s
) or time in seconds.2m
or 1w
for example!mod <add|remove|list> <role ID>
list
the roles, you do not need the role ID at the end.!mute <user ID> [reason]
!tempmute <user ID> <duration> [reason]
!unmute <user ID>
!ban <user ID> <duration> <reason>
!unban <user ID>
!reload
!reload events
You should follow the discord guide here
But the gist is:
Copy ID
Ensure that:
from commands.base import Command
and then define the class like this: class MyCommand(Command):
so it is a subclass of it)async def execute(self, message, **kwargs):
function to execute the command