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

This commit is contained in:
Seaswimmer 2023-09-01 22:13:26 -04:00
parent 491b2790dc
commit edbcc2f0e2
No known key found for this signature in database
GPG key ID: 5019678FD9CF50D8

View file

@ -104,18 +104,24 @@ class Forums(commands.Cog):
return options return options
@forumsconfig.command(name="tagset") @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 # Create select options from the proxy data
options = self.create_select_options(ctx, channel.available_tags) options = self.create_select_options(ctx, channel.available_tags)
config = Config.get_conf(None, cog_name='Forums', identifier=2352711325)
await ctx.send("Menus!", view=SelectView(options)) 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): 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) super().__init__(placeholder="Select an option", max_values=1, min_values=1, options=options)
async def callback(self, interaction: discord.Interaction): 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): class SelectView(ui.View):
def __init__(self, options, *, timeout=180): def __init__(self, options, *, timeout=180):