diff --git a/shortmute/shortmute.py b/shortmute/shortmute.py index 36178fb..c91fec3 100644 --- a/shortmute/shortmute.py +++ b/shortmute/shortmute.py @@ -99,7 +99,7 @@ class Shortmute(commands.Cog): old_message = await old_interaction.edit_original_response(embed=edit_embed, view=None) await target.timeout(until=timedelta, reason=f"User shortmuted for {readable_duration} by {old_interaction.user.name} ({old_interaction.user.id}) for: {reason}") await interaction.response.send_message(content=f"{target.mention} shortmuted for {readable_duration} by {old_interaction.user.mention} for: `{reason}`") - if await self.config.guild(old_interaction.guild_id).dm() is True: + if await self.config.guild(old_interaction.guild).dm() is True: dm_embed = discord.Embed(title=f"You've been shortmuted in {old_interaction.guild.name}!", description=f"Moderator: {old_interaction.user.mention}\nTarget: {target.mention}\nDuration: `{readable_duration}`\nReason: `{reason}`", color=await self.bot.get_embed_color(None)) if evidence: dm_embed.set_image(evidence) @@ -107,7 +107,7 @@ class Shortmute(commands.Cog): await target.send(embed=dm_embed) except discord.HTTPException as error: await old_message.edit(content="Could not message the target, user most likely has Direct Messages disabled.") - logging_channels_list = await self.config.guild(old_interaction.guild.id).logging_channels() + logging_channels_list = await self.config.guild(old_interaction.guild).logging_channels() if logging_channels_list: logging_embed = discord.Embed(title="Shortmute", description=f"Moderator: {old_interaction.user.mention} ({old_interaction.user.id})\nTarget: {target.mention} ({target.id})\nDuration: `{readable_duration}`\nReason: `{reason}`", color=await self.bot.get_embed_color(None)) if evidence: @@ -132,14 +132,14 @@ class Shortmute(commands.Cog): @commands.admin() 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!""" - current_list = await self.config.guild(ctx.guild.id).logging_channels() + current_list = await self.config.guild(ctx.guild).logging_channels() 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 self.config.guild(ctx.guild).logging_channels.set(current_list) await ctx.send(f"{channel.mention} has been added to the logging channels list.") else: already_in_list = [] @@ -157,10 +157,10 @@ class Shortmute(commands.Cog): @commands.admin() 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() + current_list = await self.config.guild(ctx.guild).logging_channels() if channel.id in current_list: current_list.remove(channel.id) - await self.config.guild(ctx.guild.id).logging_channels.set(current_list) + await self.config.guild(ctx.guild).logging_channels.set(current_list) await ctx.send(f"{channel.mention} has been removed from the logging channels list.") else: await ctx.send("Please provide a valid channel that exists in the logging channels list.") @@ -170,14 +170,14 @@ class Shortmute(commands.Cog): @commands.admin() async def shortmute_config_addrole(self, ctx: commands.Context, role: discord.Role = None): """This command adds roles to the immune roles list for immunity from the the `/shortmute` slash command.""" - current_list = await self.config.guild(ctx.guild.id).immune_roles() + current_list = await self.config.guild(ctx.guild).immune_roles() if role: if role.id in current_list: await ctx.send("This role is already in the immune roles list!") return else: current_list.append(role.id) - await self.config.guild(ctx.guild.id).immune_roles.set(current_list) + await self.config.guild(ctx.guild).immune_roles.set(current_list) await ctx.send(f"{role.mention} has been added to the logging channels list.", allowed_mentions = discord.AllowedMentions(roles=False)) else: already_in_list = [] @@ -195,10 +195,10 @@ class Shortmute(commands.Cog): @commands.admin() async def shortmute_config_removerole(self, ctx: commands.Context, role: discord.Role = None): """This command removes roles from the immune roles list to remove immunity from the the `/shortmute` slash command.""" - current_list = await self.config.guild(ctx.guild.id).immune_roles() + current_list = await self.config.guild(ctx.guild).immune_roles() if role.id in current_list: current_list.remove(role.id) - await self.config.guild(ctx.guild.id).immune_roles.set(current_list) + await self.config.guild(ctx.guild).immune_roles.set(current_list) await ctx.send(f"{role.mention} has been removed from the immune roles list.", allowed_mentions = discord.AllowedMentions(roles=False)) else: await ctx.send("Please provide a valid role that exists in the immune roles list.") @@ -208,9 +208,9 @@ class Shortmute(commands.Cog): @commands.admin() 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() + old_value = await self.config.guild(ctx.guild).dm() if enabled: - await self.config.guild(ctx.guild.id).dm.set(enabled) + await self.config.guild(ctx.guild).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!")