from rebootpy.ext import commands
import rebootpy
bot = commands.Bot(command_prefix='!', auth=auth)
@bot.command()
async def userinfo(ctx):
"""Display information about the command context."""
# Basic info
await ctx.send(f'Command: {ctx.command.name}')
await ctx.send(f'Prefix: {ctx.prefix}')
await ctx.send(f'Invoked with: {ctx.invoked_with}')
# Author info
await ctx.send(f'Author: {ctx.author.display_name}')
await ctx.send(f'Author ID: {ctx.author.id}')
# Context location
if ctx.party:
await ctx.send(f'Party: {ctx.party.id}')
await ctx.send(f'Members: {len(ctx.party.members)}')
else:
await ctx.send('Location: DM')
# Bot info
await ctx.send(f'Bot: {ctx.bot.user.display_name}')
await ctx.send(f'Total commands: {len(ctx.bot.commands)}')
# Cog info
if ctx.cog:
await ctx.send(f'Cog: {ctx.cog.qualified_name}')
@bot.group(invoke_without_command=True)
async def admin(ctx):
"""Admin commands."""
if ctx.invoked_subcommand is None:
# Show available subcommands
cmds = [c.name for c in ctx.command.commands]
await ctx.send(f'Subcommands: {", ".join(cmds)}')
@admin.command()
async def reload(ctx, extension: str):
"""Reload an extension."""
try:
ctx.bot.reload_extension(extension)
await ctx.send(f'Reloaded {extension}')
except Exception as e:
await ctx.send(f'Error: {e}')
@admin.command()
async def status(ctx):
"""Show bot status."""
await ctx.send(f'Cogs: {len(ctx.bot.cogs)}')
await ctx.send(f'Extensions: {len(ctx.bot.extensions)}')
if ctx.party:
await ctx.send(f'Party size: {len(ctx.party.members)}')
bot.run()