fix(forums): changed error message for if the targetted channel is not a forums channel (resolvedset channel)
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
d2b785207c
commit
e9cee36171
1 changed files with 9 additions and 12 deletions
|
@ -90,8 +90,6 @@ class Forums(commands.Cog):
|
||||||
"""Manages the configuration for the [p]resolved command."""
|
"""Manages the configuration for the [p]resolved command."""
|
||||||
|
|
||||||
@resolvedset.group(name='role', invoke_without_command=True, aliases=['roles'])
|
@resolvedset.group(name='role', invoke_without_command=True, aliases=['roles'])
|
||||||
@commands.guild_only()
|
|
||||||
@commands.admin()
|
|
||||||
async def resolvedset_role(self, ctx: commands.Context):
|
async def resolvedset_role(self, ctx: commands.Context):
|
||||||
"""Manages the allowed roles list."""
|
"""Manages the allowed roles list."""
|
||||||
current_list = await self.config.guild(ctx.guild).request_roles()
|
current_list = await self.config.guild(ctx.guild).request_roles()
|
||||||
|
@ -108,8 +106,6 @@ class Forums(commands.Cog):
|
||||||
await ctx.send(f"No roles are currently in the allowed roles list.\nUse `{command} add` to add some!")
|
await ctx.send(f"No roles are currently in the allowed roles list.\nUse `{command} add` to add some!")
|
||||||
|
|
||||||
@resolvedset_role.command(name='add')
|
@resolvedset_role.command(name='add')
|
||||||
@commands.guild_only()
|
|
||||||
@commands.admin()
|
|
||||||
async def resolvedset_role_add(self, ctx: commands.Context, role: discord.Role = None):
|
async def resolvedset_role_add(self, ctx: commands.Context, role: discord.Role = None):
|
||||||
"""Adds roles to the allowed roles list."""
|
"""Adds roles to the allowed roles list."""
|
||||||
current_list = await self.config.guild(ctx.guild).request_roles()
|
current_list = await self.config.guild(ctx.guild).request_roles()
|
||||||
|
@ -125,8 +121,6 @@ class Forums(commands.Cog):
|
||||||
await ctx.send("Please provide a valid role.")
|
await ctx.send("Please provide a valid role.")
|
||||||
|
|
||||||
@resolvedset_role.command(name='remove')
|
@resolvedset_role.command(name='remove')
|
||||||
@commands.guild_only()
|
|
||||||
@commands.admin()
|
|
||||||
async def resolvedset_role_remove(self, ctx: commands.Context, role: discord.Role = None):
|
async def resolvedset_role_remove(self, ctx: commands.Context, role: discord.Role = None):
|
||||||
"""Removes roles from the allowed roles list."""
|
"""Removes roles from the allowed roles list."""
|
||||||
current_list = await self.config.guild(ctx.guild).request_roles()
|
current_list = await self.config.guild(ctx.guild).request_roles()
|
||||||
|
@ -144,6 +138,15 @@ class Forums(commands.Cog):
|
||||||
options.append(discord.SelectOption(label=tag.name, emoji=emoji, description="", value=tag.id))
|
options.append(discord.SelectOption(label=tag.name, emoji=emoji, description="", value=tag.id))
|
||||||
return options
|
return options
|
||||||
|
|
||||||
|
@resolvedset.command(name="channel")
|
||||||
|
async def resolvedset_channel(self, ctx: commands.Context, channel: discord.abc.GuildChannel):
|
||||||
|
"""Sets the forums channel used by the [p]resolved command."""
|
||||||
|
if isinstance(channel, discord.ForumChannel):
|
||||||
|
await self.config.guild(ctx.guild).forum_channel.set(channel.id)
|
||||||
|
await ctx.send(f"Forum channel has been set to {channel.mention}.")
|
||||||
|
else:
|
||||||
|
await ctx.send(f"{channel.mention} is not a forums channel!")
|
||||||
|
|
||||||
@resolvedset.command(name="tag")
|
@resolvedset.command(name="tag")
|
||||||
async def resolvedset_tag(self, ctx: commands.Context, channel: discord.ForumChannel):
|
async def resolvedset_tag(self, ctx: commands.Context, channel: discord.ForumChannel):
|
||||||
"""Sets the tag used by the [p]resolved command."""
|
"""Sets the tag used by the [p]resolved command."""
|
||||||
|
@ -152,12 +155,6 @@ class Forums(commands.Cog):
|
||||||
msg = await ctx.send(f"Forum tag is currently set to `{str(tag)}`.")
|
msg = await ctx.send(f"Forum tag is currently set to `{str(tag)}`.")
|
||||||
await msg.edit(view=SelectView(msg, options))
|
await msg.edit(view=SelectView(msg, options))
|
||||||
|
|
||||||
@resolvedset.command(name="channel")
|
|
||||||
async def resolvedset_channel(self, ctx: commands.Context, channel: discord.ForumChannel):
|
|
||||||
"""Sets the tag used by the [p]resolved command."""
|
|
||||||
await self.config.guild(ctx.guild).forum_channel.set(channel.id)
|
|
||||||
await ctx.send(f"Forum channel has been set to `{channel.name}`.")
|
|
||||||
|
|
||||||
class Select(ui.Select):
|
class Select(ui.Select):
|
||||||
def __init__(self, message, options):
|
def __init__(self, message, options):
|
||||||
self.message = message
|
self.message = message
|
||||||
|
|
Loading…
Reference in a new issue