42 lines
1.3 KiB
Python
42 lines
1.3 KiB
Python
"""
|
|
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):
|
|
"""
|
|
Parent slash command for help. Never called.
|
|
"""
|
|
|
|
@request.subcommand(description="Request to change your Dakiny nickname")
|
|
async def change_username(self, interaction: nextcord.Interaction, new_username: str):
|
|
"""
|
|
Sends a message to admins to request a username change.
|
|
|
|
Args:
|
|
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)
|