Skip to content
This repository was archived by the owner on Feb 7, 2026. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 44 additions & 0 deletions cogs/moderation.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# Imports
import discord
from discord import option, ApplicationContext
from discord.ext import commands

# Commands
class Moderation(commands.Cog):
def __init__(self, bot):
self.bot = bot

@commands.slash_command(
name='kick',
description='Kicks a member from this server.'
)
@option(name="user", description="Who do you want to kick?", type=discord.User)
@option(name="reason", description="Why do you want to kick the user?", type=str, default=None)
@commands.cooldown(1, 3, commands.BucketType.user)
async def kick(self, ctx: ApplicationContext, user, reason=None):
if not ctx.author.guild_permissions.kick_members: return await ctx.respond('https://tenor.com/view/oh-yeah-high-kick-take-down-fight-gif-14272509')
else:
try:
if reason is None: await user.kick()
else: await user.kick(reason=reason)
await ctx.respond(embed=discord.Embed(title=f'{user} has been kicked.', description=f'Reason: {str(reason)}'))
except Exception: await ctx.respond(embed=discord.Embed(title='Well, something happened...', description='Either I don\'t have permission to do this, or my role isn\'t high enough.', color=discord.Colour.red()))

@commands.slash_command(
name='ban',
description='Bans a member from this server.'
)
@option(name="user", description="Who do you want to ban?", type=discord.User)
@option(name="reason", description="Why you want to ban the user?", type=str, default=None)
@commands.cooldown(1, 3, commands.BucketType.user)
async def ban(self, ctx: ApplicationContext, user, reason=None):
if not ctx.author.guild_permissions.ban_members: return await ctx.respond('https://tenor.com/view/thor-strike-admin-ban-admin-ban-gif-22545175')
else:
try:
if reason is None: await user.ban()
else: await user.ban(reason=reason)
await ctx.respond(embed=discord.Embed(title=f'{user} has been banned.', description=f'Reason: {str(reason)}'))
except Exception: await ctx.respond(embed=discord.Embed(title='Well, something happened...', description='Either I don\'t have permission to do this, or my role isn\'t high enough.', color=discord.Colour.red()))

# Initialization
def setup(bot): bot.add_cog(Moderation(bot))
45 changes: 7 additions & 38 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -224,38 +224,6 @@ async def sync(ctx: ApplicationContext):
print(e)
await ctx.respond('An error occured while resyncing. Check console.', ephemeral=True)

@client.slash_command(
name='kick',
description='Kicks a member from this server.'
)
@option(name="user", description="Who do you want to kick?", type=discord.User)
@option(name="reason", description="Why do you want to kick the user?", type=str, default=None)
@commands.cooldown(1, 3, commands.BucketType.user)
async def kick(ctx: ApplicationContext, user, reason=None):
if not ctx.author.guild_permissions.kick_members: return await ctx.respond('https://tenor.com/view/oh-yeah-high-kick-take-down-fight-gif-14272509')
else:
try:
if reason is None: await user.kick()
else: await user.kick(reason=reason)
await ctx.respond(embed=discord.Embed(title=f'{user} has been kicked.', description=f'Reason: {str(reason)}'))
except Exception: await ctx.respond(embed=discord.Embed(title='Well, something happened...', description='Either I don\'t have permission to do this, or my role isn\'t high enough.', color=discord.Colour.red()))

@client.slash_command(
name='ban',
description='Bans a member from this server.'
)
@option(name="user", description="Who do you want to ban?", type=discord.User)
@option(name="reason", description="Why you want to ban the user?", type=str, default=None)
@commands.cooldown(1, 3, commands.BucketType.user)
async def ban(ctx: ApplicationContext, user, reason=None):
if not ctx.author.guild_permissions.ban_members: return await ctx.respond('https://tenor.com/view/thor-strike-admin-ban-admin-ban-gif-22545175')
else:
try:
if reason is None: await user.ban()
else: await user.ban(reason=reason)
await ctx.respond(embed=discord.Embed(title=f'{user} has been banned.', description=f'Reason: {str(reason)}'))
except Exception: await ctx.respond(embed=discord.Embed(title='Well, something happened...', description='Either I don\'t have permission to do this, or my role isn\'t high enough.', color=discord.Colour.red()))

# Cog Commands (these cannot be moved into a cog)
cogs = client.create_group("cog", "Commands for working with isobot cogs.")

Expand Down Expand Up @@ -318,13 +286,14 @@ async def reload(ctx: ApplicationContext, cog: str):

# Initialization
active_cogs = [
"economy",
"economy",
"maths",
"reddit",
"minigames",
"automod",
"isobank",
"levelling",
"reddit",
"moderation",
"minigames",
"automod",
"isobank",
"levelling",
"fun",
"utils",
"afk"
Expand Down