mirror of
https://github.com/neoarz/Syntrel.git
synced 2025-12-25 11:40:12 +01:00
chore: ruff formatting
This commit is contained in:
@@ -9,13 +9,24 @@ class Say(commands.Cog, name="say"):
|
||||
def __init__(self, bot) -> None:
|
||||
self.bot = bot
|
||||
|
||||
async def send_embed(self, context: Context, embed: discord.Embed, *, ephemeral: bool = False, allowed_mentions: discord.AllowedMentions = None) -> None:
|
||||
async def send_embed(
|
||||
self,
|
||||
context: Context,
|
||||
embed: discord.Embed,
|
||||
*,
|
||||
ephemeral: bool = False,
|
||||
allowed_mentions: discord.AllowedMentions = None,
|
||||
) -> None:
|
||||
interaction = getattr(context, "interaction", None)
|
||||
if interaction is not None:
|
||||
if interaction.response.is_done():
|
||||
await interaction.followup.send(embed=embed, ephemeral=ephemeral, allowed_mentions=allowed_mentions)
|
||||
await interaction.followup.send(
|
||||
embed=embed, ephemeral=ephemeral, allowed_mentions=allowed_mentions
|
||||
)
|
||||
else:
|
||||
await interaction.response.send_message(embed=embed, ephemeral=ephemeral, allowed_mentions=allowed_mentions)
|
||||
await interaction.response.send_message(
|
||||
embed=embed, ephemeral=ephemeral, allowed_mentions=allowed_mentions
|
||||
)
|
||||
else:
|
||||
await context.send(embed=embed, allowed_mentions=allowed_mentions)
|
||||
|
||||
@@ -42,9 +53,9 @@ class Say(commands.Cog, name="say"):
|
||||
self.bot.logger.info(
|
||||
f"Say command used in DMs by {context.author} (ID: {context.author.id}): {message}"
|
||||
)
|
||||
|
||||
|
||||
allowed_mentions = discord.AllowedMentions.none()
|
||||
|
||||
|
||||
interaction = getattr(context, "interaction", None)
|
||||
if interaction is not None:
|
||||
is_in_guild = context.guild is not None
|
||||
@@ -57,7 +68,9 @@ class Say(commands.Cog, name="say"):
|
||||
except:
|
||||
pass
|
||||
except discord.Forbidden:
|
||||
await interaction.followup.send(message, allowed_mentions=allowed_mentions)
|
||||
await interaction.followup.send(
|
||||
message, allowed_mentions=allowed_mentions
|
||||
)
|
||||
else:
|
||||
try:
|
||||
await context.message.delete()
|
||||
@@ -88,28 +101,34 @@ class Say(commands.Cog, name="say"):
|
||||
self.bot.logger.info(
|
||||
f"Embed command used in DMs by {context.author} (ID: {context.author.id}): {message}"
|
||||
)
|
||||
|
||||
|
||||
allowed_mentions = discord.AllowedMentions.none()
|
||||
embed = discord.Embed(
|
||||
title="Say",
|
||||
description=message,
|
||||
color=0x7289DA,
|
||||
)
|
||||
embed.set_author(name="Owner", icon_url="https://yes.nighty.works/raw/zReOib.webp")
|
||||
|
||||
embed.set_author(
|
||||
name="Owner", icon_url="https://yes.nighty.works/raw/zReOib.webp"
|
||||
)
|
||||
|
||||
interaction = getattr(context, "interaction", None)
|
||||
if interaction is not None:
|
||||
is_in_guild = context.guild is not None
|
||||
await interaction.response.defer(ephemeral=is_in_guild)
|
||||
try:
|
||||
await context.channel.send(embed=embed, allowed_mentions=allowed_mentions)
|
||||
await context.channel.send(
|
||||
embed=embed, allowed_mentions=allowed_mentions
|
||||
)
|
||||
if is_in_guild:
|
||||
try:
|
||||
await interaction.delete_original_response()
|
||||
except:
|
||||
pass
|
||||
except discord.Forbidden:
|
||||
await interaction.followup.send(embed=embed, allowed_mentions=allowed_mentions)
|
||||
await interaction.followup.send(
|
||||
embed=embed, allowed_mentions=allowed_mentions
|
||||
)
|
||||
else:
|
||||
try:
|
||||
await context.message.delete()
|
||||
@@ -117,7 +136,6 @@ class Say(commands.Cog, name="say"):
|
||||
pass
|
||||
await context.send(embed=embed, allowed_mentions=allowed_mentions)
|
||||
|
||||
|
||||
async def cog_command_error(self, context: Context, error) -> None:
|
||||
if isinstance(error, (commands.NotOwner, commands.CheckFailure)):
|
||||
embed = discord.Embed(
|
||||
@@ -125,7 +143,9 @@ class Say(commands.Cog, name="say"):
|
||||
description="You are not the owner of this bot!",
|
||||
color=0xE02B2B,
|
||||
)
|
||||
embed.set_author(name="Owner", icon_url="https://yes.nighty.works/raw/zReOib.webp")
|
||||
embed.set_author(
|
||||
name="Owner", icon_url="https://yes.nighty.works/raw/zReOib.webp"
|
||||
)
|
||||
await self.send_embed(context, embed, ephemeral=True)
|
||||
else:
|
||||
raise error
|
||||
|
||||
Reference in New Issue
Block a user