fix(moderation): fixed fetching guild configs
All checks were successful
Pylint / Pylint (push) Successful in 1m13s
All checks were successful
Pylint / Pylint (push) Successful in 1m13s
This commit is contained in:
parent
90e0a4b153
commit
7c88f98a28
1 changed files with 11 additions and 11 deletions
|
@ -225,7 +225,7 @@ class Moderation(commands.Cog):
|
|||
"""Add a note to a user."""
|
||||
await interaction.response.send_message(content=f"{target.mention} has recieved a note!\n**Reason** - `{reason}`")
|
||||
if silent is None:
|
||||
silent = not await self.config.guild(interaction.guild.id).dm_users()
|
||||
silent = not await self.config.guild(interaction.guild).dm_users()
|
||||
if silent is False:
|
||||
try:
|
||||
embed = await self.embed_factory('message', interaction.guild, reason, 'note', await interaction.original_response())
|
||||
|
@ -239,7 +239,7 @@ class Moderation(commands.Cog):
|
|||
"""Warn a user."""
|
||||
await interaction.response.send_message(content=f"{target.mention} has been warned!\n**Reason** - `{reason}`")
|
||||
if silent is None:
|
||||
silent = not await self.config.guild(interaction.guild.id).dm_users()
|
||||
silent = not await self.config.guild(interaction.guild).dm_users()
|
||||
if silent is False:
|
||||
try:
|
||||
embed = await self.embed_factory('message', interaction.guild, reason, 'warned', await interaction.original_response())
|
||||
|
@ -265,7 +265,7 @@ class Moderation(commands.Cog):
|
|||
await target.timeout(parsed_time, reason=f"Muted by {interaction.user.id} for: {reason}")
|
||||
await interaction.response.send_message(content=f"{target.mention} has been muted for {humanize.precisedelta(parsed_time)}!\n**Reason** - `{reason}`")
|
||||
if silent is None:
|
||||
silent = not await self.config.guild(interaction.guild.id).dm_users()
|
||||
silent = not await self.config.guild(interaction.guild).dm_users()
|
||||
if silent is False:
|
||||
try:
|
||||
embed = await self.embed_factory('message', interaction.guild, reason, 'muted', await interaction.original_response(), parsed_time)
|
||||
|
@ -287,7 +287,7 @@ class Moderation(commands.Cog):
|
|||
reason = "No reason given."
|
||||
await interaction.response.send_message(content=f"{target.mention} has been unmuted!\n**Reason** - `{reason}`")
|
||||
if silent is None:
|
||||
silent = not await self.config.guild(interaction.guild.id).dm_users()
|
||||
silent = not await self.config.guild(interaction.guild).dm_users()
|
||||
if silent is False:
|
||||
try:
|
||||
embed = await self.embed_factory('message', interaction.guild, reason, 'unmuted', await interaction.original_response())
|
||||
|
@ -301,7 +301,7 @@ class Moderation(commands.Cog):
|
|||
"""Kick a user."""
|
||||
await interaction.response.send_message(content=f"{target.mention} has been kicked!\n**Reason** - `{reason}`")
|
||||
if silent is None:
|
||||
silent = not await self.config.guild(interaction.guild.id).dm_users()
|
||||
silent = not await self.config.guild(interaction.guild).dm_users()
|
||||
if silent is False:
|
||||
try:
|
||||
embed = await self.embed_factory('message', interaction.guild, reason, 'kicked', await interaction.original_response())
|
||||
|
@ -345,7 +345,7 @@ class Moderation(commands.Cog):
|
|||
else:
|
||||
await interaction.response.send_message(content=f"{target.mention} has been banned!\n**Reason** - `{reason}`")
|
||||
if silent is None:
|
||||
silent = not await self.config.guild(interaction.guild.id).dm_users()
|
||||
silent = not await self.config.guild(interaction.guild).dm_users()
|
||||
if silent is False:
|
||||
try:
|
||||
embed = await self.embed_factory('message', interaction.guild, reason, 'banned', await interaction.original_response())
|
||||
|
@ -370,7 +370,7 @@ class Moderation(commands.Cog):
|
|||
reason = "No reason given."
|
||||
await interaction.response.send_message(content=f"{target.mention} has been unbanned!\n**Reason** - `{reason}`")
|
||||
if silent is None:
|
||||
silent = not await self.config.guild(interaction.guild.id).dm_users()
|
||||
silent = not await self.config.guild(interaction.guild).dm_users()
|
||||
if silent is False:
|
||||
try:
|
||||
embed = await self.embed_factory('message', interaction.guild, reason, 'unbanned', await interaction.original_response())
|
||||
|
@ -507,8 +507,8 @@ class Moderation(commands.Cog):
|
|||
@checks.admin()
|
||||
async def moderationset_ignorebots(self, ctx: commands.Context):
|
||||
"""Toggle if the cog should ignore other bots' moderations."""
|
||||
await self.config.guild(ctx.guild.id).ignore_other_bots.set(not await self.config.guild(ctx.guild.id).ignore_other_bots())
|
||||
await ctx.send(f"Ignore bots setting set to {await self.config.guild(ctx.guild.id).ignore_other_bots()}")
|
||||
await self.config.guild(ctx.guild).ignore_other_bots.set(not await self.config.guild(ctx.guild).ignore_other_bots())
|
||||
await ctx.send(f"Ignore bots setting set to {await self.config.guild(ctx.guild).ignore_other_bots()}")
|
||||
|
||||
@moderationset.command(name="dm")
|
||||
@checks.admin()
|
||||
|
@ -516,8 +516,8 @@ class Moderation(commands.Cog):
|
|||
"""Toggle automatically messaging moderated users.
|
||||
|
||||
This option can be overridden by specifying the `silent` argument in any moderation command."""
|
||||
await self.config.guild(ctx.guild.id).dm_users.set(not await self.config.guild(ctx.guild.id).dm_users())
|
||||
await ctx.send(f"DM users setting set to {await self.config.guild(ctx.guild.id).dm_users()}")
|
||||
await self.config.guild(ctx.guild).dm_users.set(not await self.config.guild(ctx.guild).dm_users())
|
||||
await ctx.send(f"DM users setting set to {await self.config.guild(ctx.guild).dm_users()}")
|
||||
|
||||
@moderationset.command(name="mysql")
|
||||
@checks.is_owner()
|
||||
|
|
Loading…
Reference in a new issue