def __init__(self, view): super().__init__(placeholder="Select a position to force assign", row=2, options=[ nextcord.SelectOption(label=str(i + 1), value=str(i + 1)) for i, _ in enumerate(view.report.players) ])
async def init(self): placeholder = await self.bot._(self.parent_inter, "combat.choice.placeholder") self.deck: dict = await self.bot.cogs['UsersCog'].get_user_deck(self.user_id) self.select = Select(min_values=5, max_values=5, placeholder=placeholder, options=[ nextcord.SelectOption(label=character['personnage'], value=key) for key, character in self.deck.items() ]) self.select.callback = self.callback self.add_item(self.select)
def __init__(self, view): player_names = [ self.get_player_name(view.client.get_user(i), i) for i in view.report.players ] super().__init__( placeholder="Select a player to Administrate", row=1, options=[ nextcord.SelectOption(label=name, value=str(pl)) for pl, name in zip(view.report.players, player_names) ])
async def _cog_select_options(self) -> list[nextcord.SelectOption]: options: list[nextcord.SelectOption] = [] options.append( nextcord.SelectOption( label="Home", emoji="🏠", description="Go back to the main menu.", )) for cog, command_set in self.get_bot_mapping().items(): filtered = await self.filter_commands(command_set, sort=True) if not filtered: continue emoji = getattr(cog, "COG_EMOJI", None) options.append( nextcord.SelectOption( label=cog.qualified_name if cog else "No Category", emoji=emoji, description=cog.description[:100] if cog and cog.description else None)) return options
def __init__(self): super().__init__( title="Looking For Buddy", timeout=None, ) self.looking_for_buddy_channel_id = int( os.environ.get("LOOKING_FOR_BUDDY_CHANNEL_ID", 987390245207150663) ) self.pl_options = { "Python": PartialEmoji(name="python", id=934950343614275594), "Javascript": PartialEmoji(name="javascript", id=908457207597764678), "TypeScript": PartialEmoji(name="typescript", id=982974090400923689), "C": PartialEmoji(name="clang", id=934951942029979688), "C#": PartialEmoji(name="c_sharp", id=947603932161667132), "C++": PartialEmoji(name="cpp", id=947603931519926342), "Java": PartialEmoji(name="java", id=934957425587523624), "PHP": "🐘", "GDScript": "🕹️", "Other": "🧑💻", } self.programming_languages = nextcord.ui.Select( placeholder="Programming Languages", options=[ nextcord.SelectOption(label=name, emoji=emoji) for name, emoji in self.pl_options.items() ], min_values=1, max_values=len(self.pl_options), ) self.add_item(self.programming_languages) self.current_projects = nextcord.ui.TextInput( label="Current Projects", style=nextcord.TextInputStyle.paragraph, placeholder="Simple website", max_length=150, ) self.add_item(self.current_projects) self.region_options = { "North America": "🌎", "South America": "🌎", "Europe": "🌍", "Africa": "🌍", "Central Asia": "🌏", "East Asia": "🌏", "Oceania": "🌏", } self.region = nextcord.ui.Select( placeholder="Region", options=[ nextcord.SelectOption(label=name, emoji=emoji) for name, emoji in self.region_options.items() ], ) self.add_item(self.region) # The number of choices in select options is limited to a max of 25. # https://discord.com/developers/docs/interactions/message-components#select-menu-object-select-menu-structure age_options = [nextcord.SelectOption(label=str(i)) for i in range(13, 37)] + [ nextcord.SelectOption(label="37+") ] self.age_range = nextcord.ui.Select( placeholder="Age Range (Optional) - Select min and max", options=age_options, min_values=0, max_values=2, ) self.add_item(self.age_range) self.looking_for = nextcord.ui.TextInput( label="Looking For:", style=nextcord.TextInputStyle.paragraph, placeholder="Accountability and somebody to share ideas with", max_length=150, ) self.add_item(self.looking_for)