Cleaned up embed and event record message.

This commit is contained in:
2024-05-09 16:51:07 -04:00
parent 905314cfb5
commit c08cd84bed
+10 -14
View File
@@ -56,10 +56,11 @@ class RecordCog(commands.Cog, name="Record Commands"):
embed: nextcord.Embed = nextcord.Embed(title=name, description="") embed: nextcord.Embed = nextcord.Embed(title=name, description="")
embed.add_field(name="Participants", value="") embed.add_field(name="Participants", value="")
embed.add_field(name="Non-Discord Participants", value="") embed.add_field(name="Non-Discord Participants", value="")
embed.add_field(name="Hosted by", value=f"<@{host.id}>", inline=False)
await interaction.response.send_message( await interaction.response.send_message(
"Select all members who participated!", "Fill out event details and select all members who participated!",
view=EventView(host, name, self.bot.config), view=EventView(name, self.bot.config),
ephemeral=True, ephemeral=True,
embed=embed, embed=embed,
) )
@@ -68,10 +69,9 @@ class RecordCog(commands.Cog, name="Record Commands"):
class EventView(nextcord.ui.View): class EventView(nextcord.ui.View):
def __init__(self, host: nextcord.Member, name: str, config: DakinyConfig): def __init__(self, name: str, config: DakinyConfig):
super().__init__() super().__init__()
self.host: nextcord.Member = host
self.name: str = name self.name: str = name
self.config: DakinyConfig = config self.config: DakinyConfig = config
@@ -83,7 +83,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
): ):
await interaction.response.send_message("Cancelling", ephemeral=True) await interaction.response.edit_message(
"Canceled", ephemeral=True, embed=None, view=None
)
self.stop() self.stop()
@nextcord.ui.button(label="Edit", style=nextcord.ButtonStyle.blurple, row=1) @nextcord.ui.button(label="Edit", style=nextcord.ButtonStyle.blurple, row=1)
@@ -96,23 +98,17 @@ 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
): ):
msg = f"Event: {self.name}\n"
msg += f"Hosted by: <@{self.host.id}>\n\n"
msg += "Participants:\n"
for participant in self.event_participants.values.members:
msg += f"<@{participant.id}>\n"
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
) )
await event_channel.send(msg) await event_channel.send(embed=interaction.message.embeds[0])
self.stop() self.stop()
class ParticipantModal(nextcord.ui.Modal): class ParticipantModal(nextcord.ui.Modal):
def __init__(self, embed): def __init__(self, embed):
super().__init__( super().__init__(
"Add non-discord members as participats!", "Edit the event.",
timeout=5 * 60, timeout=5 * 60,
) )
self.embed: nextcord.Embed = embed self.embed: nextcord.Embed = embed
@@ -131,7 +127,7 @@ class ParticipantModal(nextcord.ui.Modal):
) )
self.participants: nextcord.ui.TextInput = nextcord.ui.TextInput( self.participants: nextcord.ui.TextInput = nextcord.ui.TextInput(
required=False, required=False,
label="Usernames", label="Non-Discord Usernames",
style=TextInputStyle.paragraph, style=TextInputStyle.paragraph,
placeholder="Please separate usernames with a new line.", placeholder="Please separate usernames with a new line.",
default_value=self.embed.fields[1].value, default_value=self.embed.fields[1].value,