Updated all docustrings in record.py.

This commit is contained in:
2024-05-09 17:13:59 -04:00
parent fa312eec87
commit 1495fb7ee6
+37
View File
@@ -39,6 +39,16 @@ class RecordCog(commands.Cog, name="Record Commands"):
description="An alternative host if you are recording event for someone else.",
),
):
"""
This command creates the base event recording embed and sends a message with it and the EventView
for gathering more information on the event.
Args:
interaction (nextcord.Interaction): interaction with this command.
name (str): Name of the event.
host (nextcord.Member, optional): Alternative host to user using command.
"""
# check role
if (
interaction.guild.get_role(self.bot.config.params.event_host_role_id)
@@ -69,6 +79,11 @@ class RecordCog(commands.Cog, name="Record Commands"):
class EventView(nextcord.ui.View):
"""
Class handles gathering information on an event. Has buttons to edit the information, cancel, and submit.
Also contains a UserSelect object to pick discord members.
"""
def __init__(self, name: str, config: DakinyConfig):
super().__init__()
@@ -83,6 +98,9 @@ class EventView(nextcord.ui.View):
async def cancel(
self, button: nextcord.ui.Button, interaction: nextcord.Interaction
):
"""
Cancels event submission. Removes embed and view.
"""
await interaction.response.edit_message(
"Canceled", ephemeral=True, embed=None, view=None
)
@@ -90,6 +108,9 @@ class EventView(nextcord.ui.View):
@nextcord.ui.button(label="Edit", style=nextcord.ButtonStyle.blurple, row=1)
async def edit(self, button: nextcord.ui.Button, interaction: nextcord.Interaction):
"""
Calls modal to update the text input information of the event.
"""
await interaction.response.send_modal(
ParticipantModal(interaction.message.embeds[0])
)
@@ -98,6 +119,10 @@ class EventView(nextcord.ui.View):
async def confirm(
self, button: nextcord.ui.Button, interaction: nextcord.Interaction
):
"""
Submits the event embed to the event channel. Removes view and embed from recording message.
Sends point information to database.
"""
event_channel: nextcord.TextChannel = interaction.guild.get_channel(
self.config.params.event_post_channel_id
)
@@ -105,10 +130,18 @@ class EventView(nextcord.ui.View):
await interaction.response.edit_message(
content="Event has been submitted.", view=None, embed=None
)
# TODO send point information to database. Probably will make functions to do the separate
# things. Want to try turning the embed into a dict.
self.stop()
class ParticipantModal(nextcord.ui.Modal):
"""
This modal contains all the text edits for an event. You can change the name, description, and add the usernames
of participants who are not in the discord.
"""
# TODO turn this embed into a dict
def __init__(self, embed):
super().__init__(
"Edit the event.",
@@ -150,6 +183,10 @@ class ParticipantModal(nextcord.ui.Modal):
class ParticipantSelect(nextcord.ui.UserSelect):
"""
A selection drop down for discord members. Updates the embed with all users selected.
"""
def __init__(self) -> None:
super().__init__(
min_values=1,