More filling out of the record command. The UserSelect seems to work for what I want.
build_develop / build (push) Successful in 39s

This commit is contained in:
2024-05-08 17:13:32 -04:00
parent a2afdc0295
commit 0777b71578
+40 -2
View File
@@ -18,7 +18,7 @@ class RecordCog(commands.Cog, name="Record Commands"):
super().__init__() super().__init__()
self.bot: commands.Bot = bot self.bot: commands.Bot = bot
@nextcord.slash_command() @nextcord.slash_command(guild_ids=[1000247361639030804])
async def record(self, interaction: nextcord.Interaction): async def record(self, interaction: nextcord.Interaction):
""" """
Parent slash command for record. Never called. Parent slash command for record. Never called.
@@ -28,12 +28,50 @@ class RecordCog(commands.Cog, name="Record Commands"):
async def event( async def event(
self, self,
interaction: nextcord.Interaction, interaction: nextcord.Interaction,
name: str = nextcord.SlashOption(
required=True, description="Name of the event that was hosted."
),
host: nextcord.Member = nextcord.SlashOption( host: nextcord.Member = nextcord.SlashOption(
required=False, required=False,
description="An alternative host if you are recording event for someone else.", description="An alternative host if you are recording event for someone else.",
), ),
): ):
# check role # check role
if (
interaction.guild.get_role(self.bot.config.params.event_host_role_id)
not in interaction.user.roles
):
await interaction.response.send_message(
f"You must have the <@&{self.bot.config.params.event_host_role_id}> role to record an event.",
ephemeral=True,
)
return
if host is None:
host = interaction.user
msg: str = f"Event {name} was hosted by <@{host.id}>."
await interaction.response.send_message(msg, ephemeral=True, view=EventView())
# create view to add members # create view to add members
# add points to table # add points to table
pass
class EventParticipants(nextcord.ui.UserSelect):
def __init__(self) -> None:
super().__init__(
min_values=1,
max_values=25,
)
async def callback(self, interaction: nextcord.Interaction):
await interaction.response.send_message(f"members selected: {self.values}")
class EventView(nextcord.ui.View):
def __init__(self):
super().__init__()
# Adds the dropdown to our view object.
self.add_item(EventParticipants())