import logging from discord.ext import commands logger = logging.getLogger(__name__) class UtilCog(commands.Cog): def __init__(self, bot: commands.Bot): self.bot = bot @commands.command(name="ping", description="Check bot latency.") async def ping_command(self, ctx: commands.Context) -> None: """Check the bot's latency.""" latency = round(self.bot.latency * 1000) await ctx.send(f"Pong! Latency: {latency}ms") @commands.command(name="info", description="Show bot information.") async def info_command(self, ctx: commands.Context) -> None: """Show bot information.""" await ctx.send( f"**{ctx.guild.name if ctx.guild else 'DM'}**\n" f"Bot: `{self.bot.user.name}` (ID: {self.bot.user.id})\n" f"Latency: `{self.bot.latency:.3f}s`" ) @commands.command(name="hello", description="Say hello to someone.") async def hello_command(self, ctx: commands.Context, name: str = "World"): """Say hello to someone.""" await ctx.send(f"Hello, {name}!") async def setup(bot: commands.Bot) -> None: """Register the voice_gen cog with the bot.""" await bot.add_cog(UtilCog(bot))