mirror of
https://github.com/wlinator/luminara.git
synced 2024-10-02 18:03:12 +00:00
refactor: Update misc commands
This commit is contained in:
parent
8d357840f2
commit
8b09e5c0f4
7 changed files with 65 additions and 23 deletions
|
@ -36,7 +36,6 @@ class Avatar(commands.Cog):
|
|||
@commands.hybrid_command(
|
||||
name="avatar",
|
||||
aliases=["av"],
|
||||
usage="avatar [user]",
|
||||
)
|
||||
async def avatar(
|
||||
self,
|
||||
|
|
|
@ -15,7 +15,6 @@ class Info(commands.Cog):
|
|||
|
||||
@commands.hybrid_command(
|
||||
name="info",
|
||||
usage="info",
|
||||
)
|
||||
async def info(self, ctx: commands.Context[commands.Bot]) -> None:
|
||||
memory_usage_in_mb: float = psutil.Process().memory_info().rss / (1024 * 1024)
|
||||
|
|
|
@ -13,12 +13,16 @@ class Introduction(commands.Cog):
|
|||
def __init__(self, bot: commands.Bot):
|
||||
self.bot = bot
|
||||
|
||||
@commands.hybrid_command(
|
||||
name="introduction",
|
||||
aliases=["intro"],
|
||||
usage="introduction",
|
||||
)
|
||||
@commands.hybrid_command(name="introduction", aliases=["intro"])
|
||||
async def introduction(self, ctx: commands.Context[commands.Bot]) -> None:
|
||||
"""
|
||||
Introduction command.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
ctx : commands.Context[commands.Bot]
|
||||
The context of the command.
|
||||
"""
|
||||
guild: discord.Guild | None = self.bot.get_guild(
|
||||
CONST.INTRODUCTIONS_GUILD_ID,
|
||||
)
|
||||
|
|
|
@ -9,12 +9,16 @@ class Invite(commands.Cog):
|
|||
def __init__(self, bot: commands.Bot):
|
||||
self.bot = bot
|
||||
|
||||
@commands.hybrid_command(
|
||||
name="invite",
|
||||
aliases=["inv"],
|
||||
usage="invite",
|
||||
)
|
||||
@commands.hybrid_command(name="invite", aliases=["inv"])
|
||||
async def invite(self, ctx: commands.Context[commands.Bot]) -> None:
|
||||
"""
|
||||
Invite command.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
ctx : commands.Context[commands.Bot]
|
||||
The context of the command.
|
||||
"""
|
||||
await ctx.send(
|
||||
embed=Builder.create_embed(
|
||||
theme="success",
|
||||
|
|
|
@ -8,11 +8,16 @@ class Ping(commands.Cog):
|
|||
def __init__(self, bot: commands.Bot):
|
||||
self.bot = bot
|
||||
|
||||
@commands.hybrid_command(
|
||||
name="ping",
|
||||
usage="ping",
|
||||
)
|
||||
@commands.hybrid_command(name="ping")
|
||||
async def ping(self, ctx: commands.Context[commands.Bot]) -> None:
|
||||
"""
|
||||
Ping command.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
ctx : commands.Context[commands.Bot]
|
||||
The context of the command.
|
||||
"""
|
||||
embed = Builder.create_embed(
|
||||
theme="success",
|
||||
user_name=ctx.author.name,
|
||||
|
|
|
@ -13,11 +13,16 @@ class Uptime(commands.Cog):
|
|||
self.bot: commands.Bot = bot
|
||||
self.start_time: datetime = discord.utils.utcnow()
|
||||
|
||||
@commands.hybrid_command(
|
||||
name="uptime",
|
||||
usage="uptime",
|
||||
)
|
||||
@commands.hybrid_command(name="uptime")
|
||||
async def uptime(self, ctx: commands.Context[commands.Bot]) -> None:
|
||||
"""
|
||||
Uptime command.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
ctx : commands.Context[commands.Bot]
|
||||
The context of the command.
|
||||
"""
|
||||
unix_timestamp: int = int(self.start_time.timestamp())
|
||||
|
||||
embed: Embed = Builder.create_embed(
|
||||
|
|
|
@ -52,16 +52,42 @@ class Xkcd(commands.Cog):
|
|||
|
||||
xkcd = app_commands.Group(name="xkcd", description="Get the latest xkcd comic")
|
||||
|
||||
@xkcd.command(name="latest", description="Get the latest xkcd comic")
|
||||
@xkcd.command(name="latest")
|
||||
async def xkcd_latest(self, interaction: discord.Interaction) -> None:
|
||||
"""
|
||||
Get the latest xkcd comic.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
interaction : discord.Interaction
|
||||
The interaction to get the latest comic for.
|
||||
"""
|
||||
await print_comic(interaction, latest=True)
|
||||
|
||||
@xkcd.command(name="random", description="Get a random xkcd comic")
|
||||
@xkcd.command(name="random")
|
||||
async def xkcd_random(self, interaction: discord.Interaction) -> None:
|
||||
"""
|
||||
Get a random xkcd comic.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
interaction : discord.Interaction
|
||||
The interaction to get the random comic for.
|
||||
"""
|
||||
await print_comic(interaction)
|
||||
|
||||
@xkcd.command(name="search", description="Search for an xkcd comic")
|
||||
@xkcd.command(name="search")
|
||||
async def xkcd_search(self, interaction: discord.Interaction, comic_id: int) -> None:
|
||||
"""
|
||||
Get a specific xkcd comic.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
interaction : discord.Interaction
|
||||
The interaction to get the comic for.
|
||||
comic_id : int
|
||||
The ID of the comic to get.
|
||||
"""
|
||||
await print_comic(interaction, number=comic_id)
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue