Files
Gwendolyn/gwendolyn/ext/misc.py
2024-10-29 15:20:28 +01:00

42 lines
1.5 KiB
Python

from interactions import Extension, slash_command, SlashContext, Status
from gwendolyn.utils import PARAMS as params
class MiscExtension(Extension):
"""Contains the miscellaneous commands."""
@slash_command(**params["misc"]["hello"])
async def hello(self, ctx: SlashContext):
"""Greet the bot."""
await self.other.hello_func(ctx)
@slash_command(**params["misc"]["help"])
async def help(self, ctx: SlashContext, command=""):
"""Get help for commands."""
await self.bot.other.help_func(ctx, command)
@slash_command(**params["misc"]["ping"])
async def ping(self, ctx: SlashContext):
"""Send the bot's latency."""
await ctx.send(f"Pong!\nLatency is {round(self.bot.latency * 1000)}ms")
@slash_command(**params["misc"]["thank"])
async def thank(self, ctx: SlashContext):
"""Thank the bot."""
await ctx.send("You're welcome :blush:")
@slash_command(**params["misc"]["stop"])
async def stop(self, ctx: SlashContext):
if f"{ctx.author.id}" in self.bot.admins:
await ctx.send("Goodnight...")
await self.bot.change_presence(status=Status.INVISIBLE)
# self.bot.database_funcs.wipe_games()
self.bot.log("Logging out", level=25)
await self.bot.stop()
else:
log_message = f"{ctx.author.display_name} tried to stop me!"
self.bot.log(log_message, str(ctx.channel_id))
await ctx.send(f"I don't think I will, {ctx.author.display_name}")