Refactor command definitions across various cogs to replace hybrid commands with regular commands for improved consistency and clarity. Update command structures in moderation, music, and other cogs to enhance user experience and streamline command handling.
Some checks failed
CI / Bot (Python) (push) Successful in 12s
CI / Dashboard (Next.js) (push) Failing after 9s

This commit is contained in:
TheOnlyMace
2026-07-21 22:59:25 +02:00
parent a52d84467d
commit d24b810164
25 changed files with 436 additions and 90 deletions

View File

@@ -0,0 +1,224 @@
# ╔══════════════════════════════════════════════════════════════════╗
# ║ ║
# ║ +-+-+-+-+-+-+-+-+ ║
# ║ |H|e|x|a|H|o|s|t| ║
# ║ +-+-+-+-+-+-+-+-+ ║
# ║ ║
# ║ © 2026 HexaHost — All Rights Reserved ║
# ║ ║
# ║ discord ── https://discord.gg/hexahost ║
# ║ github ── https://github.com/theoneandonlymace ║
# ║ ║
# ╚══════════════════════════════════════════════════════════════════╝
from __future__ import annotations
import discord
from discord.ext import commands
class ModHub(commands.Cog):
"""Slash/prefix hub that exposes moderation actions under `/mod <subcommand>`."""
def __init__(self, bot):
self.bot = bot
async def _get_cog(self, ctx: commands.Context, name: str):
cog = self.bot.get_cog(name)
if not cog:
await ctx.send(f"{name} module unavailable.")
return None
return cog
@commands.hybrid_group(
name="mod",
description="Moderation commands",
fallback="help",
invoke_without_command=True,
)
@commands.guild_only()
async def mod(self, ctx: commands.Context):
"""Moderation root — use `/mod <subcommand>` or `>mod <subcommand>`."""
if ctx.subcommand_passed is None:
await ctx.send_help(ctx.command)
@mod.command(name="ban", description="Ban a user")
@commands.has_permissions(ban_members=True)
@commands.bot_has_permissions(ban_members=True)
@commands.guild_only()
async def mod_ban(self, ctx: commands.Context, user: discord.User, *, reason: str = None):
cog = await self._get_cog(ctx, "Ban")
if not cog:
return
await cog.ban(ctx, user, reason=reason)
@mod.command(name="unban", description="Unban a user")
@commands.has_permissions(ban_members=True)
@commands.bot_has_permissions(ban_members=True)
@commands.guild_only()
async def mod_unban(self, ctx: commands.Context, user: discord.User, *, reason: str = None):
cog = await self._get_cog(ctx, "Unban")
if not cog:
return
await cog.unban(ctx, user, reason=reason)
@mod.command(name="kick", description="Kick a member")
@commands.has_permissions(kick_members=True)
@commands.bot_has_permissions(kick_members=True)
@commands.guild_only()
async def mod_kick(self, ctx: commands.Context, member: discord.Member, *, reason: str = None):
cog = await self._get_cog(ctx, "Kick")
if not cog:
return
await cog.kick_command(ctx, member, reason=reason)
@mod.command(name="mute", description="Mute / timeout a member")
@commands.has_permissions(moderate_members=True)
@commands.bot_has_permissions(moderate_members=True)
@commands.guild_only()
async def mod_mute(
self,
ctx: commands.Context,
user: discord.Member,
time: str = None,
*,
reason: str = None,
):
cog = await self._get_cog(ctx, "Mute")
if not cog:
return
await cog.mute(ctx, user, time, reason=reason)
@mod.command(name="unmute", description="Remove a timeout from a member")
@commands.has_permissions(moderate_members=True)
@commands.bot_has_permissions(moderate_members=True)
@commands.guild_only()
async def mod_unmute(self, ctx: commands.Context, user: discord.Member):
cog = await self._get_cog(ctx, "Unmute")
if not cog:
return
await cog.unmute(ctx, user)
@mod.command(name="warn", description="Warn a member")
@commands.has_permissions(moderate_members=True)
@commands.guild_only()
async def mod_warn(self, ctx: commands.Context, user: discord.Member, *, reason: str = None):
cog = await self._get_cog(ctx, "Warn")
if not cog:
return
await cog.warn(ctx, user, reason=reason)
@mod.command(name="clearwarns", description="Clear warnings for a member")
@commands.has_permissions(moderate_members=True)
@commands.guild_only()
async def mod_clearwarns(self, ctx: commands.Context, user: discord.Member):
cog = await self._get_cog(ctx, "Warn")
if not cog:
return
await cog.clearwarns(ctx, user)
@mod.command(name="lock", description="Lock a channel")
@commands.has_permissions(manage_channels=True)
@commands.bot_has_permissions(manage_channels=True)
@commands.guild_only()
async def mod_lock(self, ctx: commands.Context, channel: discord.TextChannel = None):
cog = await self._get_cog(ctx, "Lock")
if not cog:
return
await cog.lock_command(ctx, channel)
@mod.command(name="unlock", description="Unlock a channel")
@commands.has_permissions(manage_roles=True)
@commands.bot_has_permissions(manage_roles=True)
@commands.guild_only()
async def mod_unlock(self, ctx: commands.Context, channel: discord.TextChannel = None):
cog = await self._get_cog(ctx, "Unlock")
if not cog:
return
await cog.unlock_command(ctx, channel)
@mod.command(name="hide", description="Hide a channel")
@commands.has_permissions(manage_channels=True)
@commands.bot_has_permissions(manage_channels=True)
@commands.guild_only()
async def mod_hide(self, ctx: commands.Context, channel: discord.TextChannel = None):
cog = await self._get_cog(ctx, "Hide")
if not cog:
return
await cog.hide_command(ctx, channel)
@mod.command(name="unhide", description="Unhide a channel")
@commands.has_permissions(manage_channels=True)
@commands.bot_has_permissions(manage_channels=True)
@commands.guild_only()
async def mod_unhide(self, ctx: commands.Context, channel: discord.TextChannel = None):
cog = await self._get_cog(ctx, "Unhide")
if not cog:
return
await cog.unhide_command(ctx, channel)
@mod.command(name="lockall", description="Lock all channels")
@commands.has_permissions(administrator=True)
@commands.guild_only()
async def mod_lockall(self, ctx: commands.Context):
cog = await self._get_cog(ctx, "Moderation")
if not cog:
return
await cog.lockall(ctx)
@mod.command(name="unlockall", description="Unlock all channels")
@commands.has_permissions(administrator=True)
@commands.guild_only()
async def mod_unlockall(self, ctx: commands.Context):
cog = await self._get_cog(ctx, "Moderation")
if not cog:
return
await cog.unlockall(ctx)
@mod.command(name="nuke", description="Nuke the current channel")
@commands.has_permissions(manage_channels=True)
@commands.guild_only()
async def mod_nuke(self, ctx: commands.Context):
cog = await self._get_cog(ctx, "Moderation")
if not cog:
return
await cog._nuke(ctx)
@mod.command(name="slowmode", description="Set channel slowmode")
@commands.has_permissions(manage_messages=True)
@commands.guild_only()
async def mod_slowmode(self, ctx: commands.Context, seconds: int = 0):
cog = await self._get_cog(ctx, "Moderation")
if not cog:
return
await cog._slowmode(ctx, seconds)
@mod.command(name="nick", description="Change a member's nickname")
@commands.has_permissions(manage_nicknames=True)
@commands.bot_has_permissions(manage_nicknames=True)
@commands.guild_only()
async def mod_nick(
self,
ctx: commands.Context,
member: discord.Member,
*,
name: str = None,
):
cog = await self._get_cog(ctx, "Moderation")
if not cog:
return
await cog.changenickname(ctx, member, name=name)
@mod.command(name="audit", description="View recent audit log entries")
@commands.has_permissions(view_audit_log=True)
@commands.bot_has_permissions(view_audit_log=True)
@commands.guild_only()
async def mod_audit(self, ctx: commands.Context, limit: int):
cog = await self._get_cog(ctx, "Moderation")
if not cog:
return
await cog.auditlog(ctx, limit)
async def setup(bot):
await bot.add_cog(ModHub(bot))