fix: fixed logging being disabled if dms were disabled
This commit is contained in:
parent
f72ed78b60
commit
f222aedd77
1 changed files with 18 additions and 18 deletions
|
@ -103,15 +103,15 @@ class Shortmute(commands.Cog):
|
||||||
await target.send(embed=dm_embed)
|
await target.send(embed=dm_embed)
|
||||||
except discord.HTTPException as error:
|
except discord.HTTPException as error:
|
||||||
await message.edit(content="Could not message the target, user most likely has Direct Messages disabled.")
|
await message.edit(content="Could not message the target, user most likely has Direct Messages disabled.")
|
||||||
logging_channels_list = await self.config.guild(interaction.guild).logging_channels()
|
logging_channels_list = await self.config.guild(interaction.guild).logging_channels()
|
||||||
if logging_channels_list:
|
if logging_channels_list:
|
||||||
logging_embed = discord.Embed(title="User Shortmuted", description=f"**Moderator:** {interaction.user.mention} ({interaction.user.id})\n**Target:** {target.mention} ({target.id})\n**Duration:** {readable_duration}\n**Reason:** `{reason}`\n**Confirmation Skipped:** True", color=await self.bot.get_embed_color(None))
|
logging_embed = discord.Embed(title="User Shortmuted", description=f"**Moderator:** {interaction.user.mention} ({interaction.user.id})\n**Target:** {target.mention} ({target.id})\n**Duration:** {readable_duration}\n**Reason:** `{reason}`\n**Confirmation Skipped:** True", color=await self.bot.get_embed_color(None))
|
||||||
logging_embed.set_footer(text="/shortmute")
|
logging_embed.set_footer(text="/shortmute")
|
||||||
if evidence:
|
if evidence:
|
||||||
logging_embed.set_image(url=evidence)
|
logging_embed.set_image(url=evidence)
|
||||||
for channel_id in logging_channels_list:
|
for channel_id in logging_channels_list:
|
||||||
channel_obj = interaction.guild.get_channel(channel_id)
|
channel_obj = interaction.guild.get_channel(channel_id)
|
||||||
await channel_obj.send(embed=logging_embed)
|
await channel_obj.send(embed=logging_embed)
|
||||||
|
|
||||||
class ShortmuteButtons(ui.View):
|
class ShortmuteButtons(ui.View):
|
||||||
def __init__(self, timeout, passed_info: dict):
|
def __init__(self, timeout, passed_info: dict):
|
||||||
|
@ -145,15 +145,15 @@ class Shortmute(commands.Cog):
|
||||||
await target.send(embed=dm_embed)
|
await target.send(embed=dm_embed)
|
||||||
except discord.HTTPException as error:
|
except discord.HTTPException as error:
|
||||||
await old_message.edit(content="Could not message the target, user most likely has Direct Messages disabled.")
|
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).logging_channels()
|
logging_channels_list = await self.config.guild(old_interaction.guild).logging_channels()
|
||||||
if logging_channels_list:
|
if logging_channels_list:
|
||||||
logging_embed = discord.Embed(title="User Shortmuted", description=f"**Moderator:** {old_interaction.user.mention} ({old_interaction.user.id})\n**Target:** {target.mention} ({target.id})\n**Duration:** {readable_duration}\n**Reason:** `{reason}`\n**Confirmation Skipped:** False", color=color)
|
logging_embed = discord.Embed(title="User Shortmuted", description=f"**Moderator:** {old_interaction.user.mention} ({old_interaction.user.id})\n**Target:** {target.mention} ({target.id})\n**Duration:** {readable_duration}\n**Reason:** `{reason}`\n**Confirmation Skipped:** False", color=color)
|
||||||
logging_embed.set_footer(text="/shortmute")
|
logging_embed.set_footer(text="/shortmute")
|
||||||
if evidence:
|
if evidence:
|
||||||
logging_embed.set_image(url=evidence)
|
logging_embed.set_image(url=evidence)
|
||||||
for channel_id in logging_channels_list:
|
for channel_id in logging_channels_list:
|
||||||
channel_obj = old_interaction.guild.get_channel(channel_id)
|
channel_obj = old_interaction.guild.get_channel(channel_id)
|
||||||
await channel_obj.send(embed=logging_embed)
|
await channel_obj.send(embed=logging_embed)
|
||||||
|
|
||||||
@ui.button(label="No", style=discord.ButtonStyle.danger)
|
@ui.button(label="No", style=discord.ButtonStyle.danger)
|
||||||
async def shortmute_button_no(self, button: ui.Button, interaction: discord.Interaction):
|
async def shortmute_button_no(self, button: ui.Button, interaction: discord.Interaction):
|
||||||
|
|
Loading…
Reference in a new issue