mirror of
https://github.com/neoarz/Syntrel.git
synced 2025-12-25 03:40:11 +01:00
refactor(botinfo): now seperate command
This commit is contained in:
@@ -4,7 +4,6 @@ from discord.ext.commands import Context
|
||||
|
||||
from .ping import ping_command
|
||||
from .uptime import uptime_command
|
||||
from .botinfo import botinfo_command
|
||||
from .serverinfo import serverinfo_command
|
||||
from .feedback import feedback_command
|
||||
|
||||
@@ -32,7 +31,7 @@ class General(commands.GroupCog, name="general"):
|
||||
color=0x7289DA
|
||||
)
|
||||
embed.set_author(name="General", icon_url="https://yes.nighty.works/raw/y5SEZ9.webp")
|
||||
embed.add_field(name="Available", value="ping, uptime, botinfo, serverinfo, feedback", inline=False)
|
||||
embed.add_field(name="Available", value="ping, uptime, serverinfo, feedback", inline=False)
|
||||
await context.send(embed=embed)
|
||||
|
||||
async def _invoke_hybrid(self, context: Context, name: str):
|
||||
@@ -50,10 +49,6 @@ class General(commands.GroupCog, name="general"):
|
||||
async def general_group_uptime(self, context: Context):
|
||||
await self._invoke_hybrid(context, "uptime")
|
||||
|
||||
@general_group.command(name="botinfo")
|
||||
async def general_group_botinfo(self, context: Context):
|
||||
await self._invoke_hybrid(context, "botinfo")
|
||||
|
||||
@general_group.command(name="serverinfo")
|
||||
async def general_group_serverinfo(self, context: Context):
|
||||
await self._invoke_hybrid(context, "serverinfo")
|
||||
@@ -78,14 +73,6 @@ class General(commands.GroupCog, name="general"):
|
||||
async def uptime(self, context):
|
||||
return await uptime_command()(self, context)
|
||||
|
||||
@commands.check(_require_group_prefix)
|
||||
@commands.hybrid_command(
|
||||
name="botinfo",
|
||||
description="Get some useful (or not) information about the bot.",
|
||||
)
|
||||
async def botinfo(self, context):
|
||||
return await botinfo_command()(self, context)
|
||||
|
||||
@commands.check(_require_group_prefix)
|
||||
@commands.hybrid_command(
|
||||
name="serverinfo",
|
||||
@@ -108,6 +95,5 @@ async def setup(bot) -> None:
|
||||
|
||||
bot.logger.info("Loaded extension 'general.ping'")
|
||||
bot.logger.info("Loaded extension 'general.uptime'")
|
||||
bot.logger.info("Loaded extension 'general.botinfo'")
|
||||
bot.logger.info("Loaded extension 'general.serverinfo'")
|
||||
bot.logger.info("Loaded extension 'general.feedback'")
|
||||
|
||||
@@ -1,30 +0,0 @@
|
||||
import platform
|
||||
import discord
|
||||
from discord.ext import commands
|
||||
|
||||
def botinfo_command():
|
||||
@commands.hybrid_command(
|
||||
name="botinfo",
|
||||
description="Get some useful (or not) information about the bot.",
|
||||
)
|
||||
async def botinfo(self, context):
|
||||
embed = discord.Embed(
|
||||
title="Syntrel Discord Bot",
|
||||
color=0x7289DA,
|
||||
)
|
||||
embed.set_author(name="Bot Information", icon_url="https://yes.nighty.works/raw/gSxqzV.png")
|
||||
embed.add_field(name="Owner:", value="[neoarz](https://discordapp.com/users/1015372540937502851)", inline=True)
|
||||
embed.add_field(
|
||||
name="Python Version:", value=f"{platform.python_version()}", inline=True
|
||||
)
|
||||
embed.add_field(
|
||||
name="Prefix:",
|
||||
value=f"/ (Slash Commands) or {self.bot.bot_prefix} for normal commands",
|
||||
inline=False,
|
||||
)
|
||||
if getattr(context, "interaction", None):
|
||||
await context.interaction.response.send_message(embed=embed, ephemeral=True)
|
||||
else:
|
||||
await context.send(embed=embed)
|
||||
|
||||
return botinfo
|
||||
Reference in New Issue
Block a user