From edbcc2f0e29af06aba4ac49cdee214b88378de0e Mon Sep 17 00:00:00 2001 From: SeaswimmerTheFsh Date: Fri, 1 Sep 2023 22:13:26 -0400 Subject: [PATCH] feat(forums): made the configuration options for tagset actually do something --- forums/forums.py | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/forums/forums.py b/forums/forums.py index 36cedfb..3526fe0 100644 --- a/forums/forums.py +++ b/forums/forums.py @@ -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):