Create initial command action.

This commit is contained in:
2023-07-29 16:35:03 -04:00
parent f71df0b7f4
commit 9cae7d002a
2 changed files with 15 additions and 0 deletions
+2
View File
@@ -4,6 +4,7 @@ Cog loader. Adds all command cogs to the bot.
from nextcord.ext import commands
from cogs.commands.request import RequestCog
from cogs.commands.test import TestCog
@@ -13,4 +14,5 @@ def setup(bot: commands.Bot):
"""
Adds all command classes to bot.
"""
bot.add_cog(RequestCog(bot))
bot.add_cog(TestCog(bot))
+13
View File
@@ -5,12 +5,20 @@ Contains commands to request things from admins.
import nextcord
from nextcord.ext import commands
from config import DakinyConfig
class RequestCog(commands.Cog, name="Request Commands"):
"""
Class holds request commands.
"""
def __init__(self, bot) -> None:
"""
Default constructor for RequestCog class. Does nothing.
"""
self.bot: commands.Bot = bot
@nextcord.slash_command()
async def request(self, interaction: nextcord.Interaction):
"""
@@ -26,3 +34,8 @@ class RequestCog(commands.Cog, name="Request Commands"):
interaction (nextcord.Interaction): Interaction that invoked the command.
new_username(str): The username to change to.
"""
config: DakinyConfig = self.bot.config
content = f'<@{interaction.user.id}> would like to change their username to "{new_username}"'
await self.bot.get_channel(config.params.admin_channel_id).send(content=content)
await interaction.response.send_message("Request sent to admins.", ephemeral=True)