mirror of
https://github.com/neoarz/Syntrel.git
synced 2025-12-25 11:40:12 +01:00
refactor(general): commands into GroupCog
Migrated general commands (ping, uptime, botinfo, serverinfo, feedback) into a single GroupCog in cogs/general/__init__.py for better organization and maintainability. Converted individual command files to export command functions instead of Cogs. Updated bot.py to load the new general extension. Renamed help.py for consistency.
This commit is contained in:
@@ -1,7 +1,5 @@
|
||||
import discord
|
||||
from discord.ext import commands
|
||||
from discord.ext.commands import Context
|
||||
|
||||
|
||||
class UptimeView(discord.ui.View):
|
||||
def __init__(self, bot):
|
||||
@@ -18,21 +16,12 @@ class UptimeView(discord.ui.View):
|
||||
embed.set_author(name="Uptime", icon_url="https://yes.nighty.works/raw/y5SEZ9.webp")
|
||||
await interaction.response.edit_message(embed=embed, view=self)
|
||||
|
||||
|
||||
class Uptime(commands.Cog, name="uptime"):
|
||||
def __init__(self, bot) -> None:
|
||||
self.bot = bot
|
||||
|
||||
def uptime_command():
|
||||
@commands.hybrid_command(
|
||||
name="uptime",
|
||||
description="Check how long the bot has been running.",
|
||||
)
|
||||
async def uptime(self, context: Context) -> None:
|
||||
"""
|
||||
Check how long the bot has been running.
|
||||
|
||||
:param context: The hybrid command context.
|
||||
"""
|
||||
async def uptime(self, context):
|
||||
embed = discord.Embed(
|
||||
title="Bot Uptime",
|
||||
description=f"The bot has been running for **{self.bot.get_uptime()}**",
|
||||
@@ -48,7 +37,5 @@ class Uptime(commands.Cog, name="uptime"):
|
||||
await inter.followup.send(embed=embed, view=view, ephemeral=True)
|
||||
else:
|
||||
await context.send(embed=embed, view=view)
|
||||
|
||||
|
||||
async def setup(bot) -> None:
|
||||
await bot.add_cog(Uptime(bot))
|
||||
|
||||
return uptime
|
||||
|
||||
Reference in New Issue
Block a user