Discord Bots – MoveIt & MuteMediator
Introduction
This project showcases two playful yet practical Discord bots, MoveIt and MuteMediator, created to experiment with Discord’s API and gain experience building interactive integrations.
Both bots were designed with a social twist, aimed at bringing humor and moderation tools into voice channels with friends.
- MoveIt: Rapidly moves a selected user through multiple voice channels before returning them to their original location.
- MuteMediator: Temporarily server-mutes two users to de-escalate heated discussions.
These projects provided an engaging way to learn about bot commands, member management, and asynchronous event handling in Discord.
Note: These bots were personal learning projects intended for private server fun.
Objectives
MoveIt Bot
- Create a command (
!move @user) to move a target user through a predefined sequence of voice channels. - Implement timed delays between moves for comedic effect.
- Return the user to their original channel at the end.
MuteMediator Bot
- Create a command (
!mm @user1 @user2) to temporarily server mute two members. - Automatically unmute after 30 seconds.
- Provide user feedback via chat messages.
Shared Goals
- Learn to use
discord.pyfor command creation and member control. - Work with asynchronous operations for timed actions.
- Build a foundation for future interactive bots.
Program Architecture
Both bots share a similar structure using the discord.py library:
- Command Definitions:
Each bot defines its own command (movefor MoveIt,mmfor MuteMediator) using thecommandsextension. - Event Handlers:
on_readyevents confirm the bot’s startup in the console. - Asynchronous Actions:
Use ofasyncio.sleep()to implement timed delays between actions. - Configuration Management:
Sensitive tokens stored in separate configuration files (configMoveBot.py/configConflictResolution.py).
Program Flow
MoveIt
- User invokes
!move @DiscordUser. - Bot stores the target user’s current voice channel.
- Bot iterates through a hardcoded list of channel IDs:
- Moves the user to each channel with a 0.5 second pause in between.
- After the last channel, the bot returns the user to their original voice channel.
MuteMediator
- User invokes
!mm @User1 @User2. - Bot server mutes both users.
- Bot sends a confirmation message to the text channel.
- Bot waits 30 seconds.
- Bot unmutes both users and notifies the channel.
Procedure
Set Up a Discord Application
- Visit https://discord.com/developers/applications.
- Create a new application, add a bot, and copy its token.
Install Required Libraries
pip install discord.pyConfigure Tokens
- Store bot tokens in a separate file apart from the main source code (e.g., configMoveBot.py and configConflictResolution.py).
Run the bots
1 2python moveit.py python mutemediator.py
Python Source Code
Below are the source code implementations for each bot.
MoveIt
| |
MuteMediator
| |