Updated all docustrings in record.py.
This commit is contained in:
@@ -39,6 +39,16 @@ class RecordCog(commands.Cog, name="Record Commands"):
|
|||||||
description="An alternative host if you are recording event for someone else.",
|
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
|
# check role
|
||||||
if (
|
if (
|
||||||
interaction.guild.get_role(self.bot.config.params.event_host_role_id)
|
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 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):
|
def __init__(self, name: str, config: DakinyConfig):
|
||||||
super().__init__()
|
super().__init__()
|
||||||
|
|
||||||
@@ -83,6 +98,9 @@ class EventView(nextcord.ui.View):
|
|||||||
async def cancel(
|
async def cancel(
|
||||||
self, button: nextcord.ui.Button, interaction: nextcord.Interaction
|
self, button: nextcord.ui.Button, interaction: nextcord.Interaction
|
||||||
):
|
):
|
||||||
|
"""
|
||||||
|
Cancels event submission. Removes embed and view.
|
||||||
|
"""
|
||||||
await interaction.response.edit_message(
|
await interaction.response.edit_message(
|
||||||
"Canceled", ephemeral=True, embed=None, view=None
|
"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)
|
@nextcord.ui.button(label="Edit", style=nextcord.ButtonStyle.blurple, row=1)
|
||||||
async def edit(self, button: nextcord.ui.Button, interaction: nextcord.Interaction):
|
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(
|
await interaction.response.send_modal(
|
||||||
ParticipantModal(interaction.message.embeds[0])
|
ParticipantModal(interaction.message.embeds[0])
|
||||||
)
|
)
|
||||||
@@ -98,6 +119,10 @@ class EventView(nextcord.ui.View):
|
|||||||
async def confirm(
|
async def confirm(
|
||||||
self, button: nextcord.ui.Button, interaction: nextcord.Interaction
|
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(
|
event_channel: nextcord.TextChannel = interaction.guild.get_channel(
|
||||||
self.config.params.event_post_channel_id
|
self.config.params.event_post_channel_id
|
||||||
)
|
)
|
||||||
@@ -105,10 +130,18 @@ class EventView(nextcord.ui.View):
|
|||||||
await interaction.response.edit_message(
|
await interaction.response.edit_message(
|
||||||
content="Event has been submitted.", view=None, embed=None
|
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()
|
self.stop()
|
||||||
|
|
||||||
|
|
||||||
class ParticipantModal(nextcord.ui.Modal):
|
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):
|
def __init__(self, embed):
|
||||||
super().__init__(
|
super().__init__(
|
||||||
"Edit the event.",
|
"Edit the event.",
|
||||||
@@ -150,6 +183,10 @@ class ParticipantModal(nextcord.ui.Modal):
|
|||||||
|
|
||||||
|
|
||||||
class ParticipantSelect(nextcord.ui.UserSelect):
|
class ParticipantSelect(nextcord.ui.UserSelect):
|
||||||
|
"""
|
||||||
|
A selection drop down for discord members. Updates the embed with all users selected.
|
||||||
|
"""
|
||||||
|
|
||||||
def __init__(self) -> None:
|
def __init__(self) -> None:
|
||||||
super().__init__(
|
super().__init__(
|
||||||
min_values=1,
|
min_values=1,
|
||||||
|
|||||||
Reference in New Issue
Block a user