feat(forums): made the configuration options for tagset actually do something
Some checks reported warnings
Gitea Actions Demo / Explore-Gitea-Actions (push) Has been cancelled
Some checks reported warnings
Gitea Actions Demo / Explore-Gitea-Actions (push) Has been cancelled
This commit is contained in:
parent
491b2790dc
commit
edbcc2f0e2
1 changed files with 11 additions and 5 deletions
|
@ -104,18 +104,24 @@ class Forums(commands.Cog):
|
|||
return options
|
||||
|
||||
@forumsconfig.command(name="tagset")
|
||||
async def forumsconfig_tag_set(self, ctx, channel: discord.ForumChannel):
|
||||
async def forumsconfig_tag_set(self, ctx: commands.Context, channel: discord.ForumChannel):
|
||||
# Create select options from the proxy data
|
||||
options = self.create_select_options(ctx, channel.available_tags)
|
||||
|
||||
await ctx.send("Menus!", view=SelectView(options))
|
||||
config = Config.get_conf(None, cog_name='Forums', identifier=2352711325)
|
||||
tag = config.guild(ctx.guild).forum_tag()
|
||||
msg = await ctx.send(f"Forum tag is currently set to `{tag}`.", view=SelectView(msg, options))
|
||||
|
||||
class Select(ui.Select):
|
||||
def __init__(self, options):
|
||||
def __init__(self, message, options):
|
||||
self.message = message
|
||||
super().__init__(placeholder="Select an option", max_values=1, min_values=1, options=options)
|
||||
|
||||
async def callback(self, interaction: discord.Interaction):
|
||||
await interaction.response.send_message(content=f"Your choice is {self.values[0]}!", ephemeral=True)
|
||||
msg: discord.Message = self.message
|
||||
await interaction.response.defer()
|
||||
config = Config.get_conf(None, cog_name='Forums', identifier=2352711325)
|
||||
config.guild(msg.guild).set.forum_tag(self.values[0])
|
||||
await msg.edit(f"Set resolved tag to {self.values[0]}", view=None)
|
||||
|
||||
class SelectView(ui.View):
|
||||
def __init__(self, options, *, timeout=180):
|
||||
|
|
Loading…
Reference in a new issue