from rebootpy.ext import commands
class Moderation(commands.Cog, name='Mod Tools'):
"""Moderation commands for party management."""
def __init__(self):
self.action_log = []
async def cog_check(self, ctx):
"""Only party leaders can use these commands."""
return ctx.party and ctx.author.leader
async def cog_before_invoke(self, ctx):
"""Log all moderation actions."""
self.action_log.append({
'user': ctx.author.id,
'command': ctx.command.name,
'time': ctx.message.created_at
})
@commands.command()
async def kick(self, ctx, member_name: str):
"""Kick a member from the party."""
await ctx.send(f'Kicking {member_name}...')
# Kick logic here
@commands.command()
async def promote(self, ctx, member_name: str):
"""Promote a member to party leader."""
await ctx.send(f'Promoting {member_name}...')
# Promote logic here
@commands.command()
async def logs(self, ctx):
"""View moderation logs."""
await ctx.send(f'Total actions: {len(self.action_log)}')
async def cog_command_error(self, ctx, error):
if isinstance(error, commands.CheckFailure):
await ctx.send('You must be party leader to use this!')
return True
return False
def cog_unload(self):
"""Save logs before unloading."""
print(f'Saving {len(self.action_log)} log entries...')
def extension_setup(bot):
bot.add_cog(Moderation())