fix: bad indents were preventing config command group from working
This commit is contained in:
parent
0a33858027
commit
615bf62d8b
1 changed files with 49 additions and 49 deletions
|
@ -114,56 +114,56 @@ class Shortmute(commands.Cog):
|
||||||
message = await self.passed_info['interaction'].edit_original_response(content="Command cancelled.", view=None, embed=None)
|
message = await self.passed_info['interaction'].edit_original_response(content="Command cancelled.", view=None, embed=None)
|
||||||
await message.delete(delay=3)
|
await message.delete(delay=3)
|
||||||
|
|
||||||
@commands.group(name='shortmuteset', autohelp=True)
|
@commands.group(name='shortmuteset', autohelp=True)
|
||||||
@commands.guild_only()
|
@commands.guild_only()
|
||||||
async def shortmute_config(self, ctx: commands.Context):
|
async def shortmute_config(self, ctx: commands.Context):
|
||||||
"""This command group is used to configure the `/shortmute` slash command."""
|
"""This command group is used to configure the `/shortmute` slash command."""
|
||||||
|
|
||||||
@shortmute_config.command(name='addchannel')
|
@shortmute_config.command(name='addchannel')
|
||||||
@commands.guild_only()
|
@commands.guild_only()
|
||||||
async def shortmute_config_addchannel(self, ctx: commands.Context, channel: discord.TextChannel = None):
|
async def shortmute_config_addchannel(self, ctx: commands.Context, channel: discord.TextChannel = None):
|
||||||
"""This command changes where the `/shortmute` slash command will log shortmutes. You can set multiple channels as well!"""
|
"""This command changes where the `/shortmute` slash command will log shortmutes. You can set multiple channels as well!"""
|
||||||
current_list = await self.config.guild(ctx.guild.id).logging_channels()
|
current_list = await self.config.guild(ctx.guild.id).logging_channels()
|
||||||
if channel:
|
if channel:
|
||||||
if channel.id in current_list:
|
|
||||||
await ctx.send("This channel is already in the logging channel list!")
|
|
||||||
return
|
|
||||||
else:
|
|
||||||
current_list.append(channel.id)
|
|
||||||
await self.config.guild(ctx.guild.id).logging_channels.set(current_list)
|
|
||||||
await ctx.send(f"{channel.mention} has been added to the logging channels list.")
|
|
||||||
else:
|
|
||||||
already_in_list = []
|
|
||||||
for channel_id in current_list:
|
|
||||||
channel_obj = ctx.guild.get_channel(channel_id)
|
|
||||||
if channel_obj:
|
|
||||||
already_in_list.append(channel_obj.mention)
|
|
||||||
if already_in_list:
|
|
||||||
await ctx.send("Channels already in the list:\n" + "\n".join(already_in_list))
|
|
||||||
else:
|
|
||||||
await ctx.send("Please provide a valid channel.")
|
|
||||||
|
|
||||||
@shortmute_config.command(name='removechannel')
|
|
||||||
@commands.guild_only()
|
|
||||||
async def shortmute_config_removechannel(self, ctx: commands.Context, channel: discord.TextChannel = None):
|
|
||||||
"""This command removes a channel from the `/shortmute`slash command's logging channels list."""
|
|
||||||
current_list = await self.config.guild(ctx.guild.id).logging_channels()
|
|
||||||
if channel.id in current_list:
|
if channel.id in current_list:
|
||||||
current_list.remove(channel.id)
|
await ctx.send("This channel is already in the logging channel list!")
|
||||||
await self.config.guild(ctx.guild.id).logging_channels.set(current_list)
|
return
|
||||||
await ctx.send(f"{channel.mention} has been removed from the logging channels list.")
|
|
||||||
else:
|
else:
|
||||||
await ctx.send("Please provide a valid channel that exists in the logging channels list.")
|
current_list.append(channel.id)
|
||||||
|
await self.config.guild(ctx.guild.id).logging_channels.set(current_list)
|
||||||
|
await ctx.send(f"{channel.mention} has been added to the logging channels list.")
|
||||||
|
else:
|
||||||
|
already_in_list = []
|
||||||
|
for channel_id in current_list:
|
||||||
|
channel_obj = ctx.guild.get_channel(channel_id)
|
||||||
|
if channel_obj:
|
||||||
|
already_in_list.append(channel_obj.mention)
|
||||||
|
if already_in_list:
|
||||||
|
await ctx.send("Channels already in the list:\n" + "\n".join(already_in_list))
|
||||||
|
else:
|
||||||
|
await ctx.send("Please provide a valid channel.")
|
||||||
|
|
||||||
@shortmute_config.command(name='dm')
|
@shortmute_config.command(name='removechannel')
|
||||||
@commands.guild_only()
|
@commands.guild_only()
|
||||||
async def shortmute_config_dm(self, ctx: commands.Context, enabled: bool = None):
|
async def shortmute_config_removechannel(self, ctx: commands.Context, channel: discord.TextChannel = None):
|
||||||
"""This command changes if the `/shortmute` slash command Direct Messages its target."""
|
"""This command removes a channel from the `/shortmute`slash command's logging channels list."""
|
||||||
old_value = await self.config.guild(ctx.guild.id).dm()
|
current_list = await self.config.guild(ctx.guild.id).logging_channels()
|
||||||
if enabled:
|
if channel.id in current_list:
|
||||||
await self.config.guild(ctx.guild.id).dm.set(enabled)
|
current_list.remove(channel.id)
|
||||||
await ctx.send(content=f"Shortmute Direct Message setting changed!\nOld value: `{old_value}`\nNew value: `{enabled}`")
|
await self.config.guild(ctx.guild.id).logging_channels.set(current_list)
|
||||||
elif old_value is True:
|
await ctx.send(f"{channel.mention} has been removed from the logging channels list.")
|
||||||
await ctx.send(content="Shortmute Direct Messages are currently enabled!")
|
else:
|
||||||
elif old_value is False:
|
await ctx.send("Please provide a valid channel that exists in the logging channels list.")
|
||||||
await ctx.send(content="Shortmute Direct Messages are currently disabled!")
|
|
||||||
|
@shortmute_config.command(name='dm')
|
||||||
|
@commands.guild_only()
|
||||||
|
async def shortmute_config_dm(self, ctx: commands.Context, enabled: bool = None):
|
||||||
|
"""This command changes if the `/shortmute` slash command Direct Messages its target."""
|
||||||
|
old_value = await self.config.guild(ctx.guild.id).dm()
|
||||||
|
if enabled:
|
||||||
|
await self.config.guild(ctx.guild.id).dm.set(enabled)
|
||||||
|
await ctx.send(content=f"Shortmute Direct Message setting changed!\nOld value: `{old_value}`\nNew value: `{enabled}`")
|
||||||
|
elif old_value is True:
|
||||||
|
await ctx.send(content="Shortmute Direct Messages are currently enabled!")
|
||||||
|
elif old_value is False:
|
||||||
|
await ctx.send(content="Shortmute Direct Messages are currently disabled!")
|
||||||
|
|
Loading…
Reference in a new issue