More filling out of the record command. The UserSelect seems to work for what I want.
build_develop / build (push) Successful in 39s
build_develop / build (push) Successful in 39s
This commit is contained in:
+40
-2
@@ -18,7 +18,7 @@ class RecordCog(commands.Cog, name="Record Commands"):
|
||||
super().__init__()
|
||||
self.bot: commands.Bot = bot
|
||||
|
||||
@nextcord.slash_command()
|
||||
@nextcord.slash_command(guild_ids=[1000247361639030804])
|
||||
async def record(self, interaction: nextcord.Interaction):
|
||||
"""
|
||||
Parent slash command for record. Never called.
|
||||
@@ -28,12 +28,50 @@ class RecordCog(commands.Cog, name="Record Commands"):
|
||||
async def event(
|
||||
self,
|
||||
interaction: nextcord.Interaction,
|
||||
name: str = nextcord.SlashOption(
|
||||
required=True, description="Name of the event that was hosted."
|
||||
),
|
||||
host: nextcord.Member = nextcord.SlashOption(
|
||||
required=False,
|
||||
description="An alternative host if you are recording event for someone else.",
|
||||
),
|
||||
):
|
||||
# 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
|
||||
# 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())
|
||||
|
||||
Reference in New Issue
Block a user