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:
@@ -8,13 +8,17 @@ class Sync(commands.Cog, name="sync"):
|
||||
def __init__(self, bot) -> None:
|
||||
self.bot = bot
|
||||
|
||||
async def send_embed(self, context: Context, embed: discord.Embed, *, ephemeral: bool = False) -> None:
|
||||
async def send_embed(
|
||||
self, context: Context, embed: discord.Embed, *, ephemeral: bool = False
|
||||
) -> None:
|
||||
interaction = getattr(context, "interaction", None)
|
||||
if interaction is not None:
|
||||
if interaction.response.is_done():
|
||||
await interaction.followup.send(embed=embed, ephemeral=ephemeral)
|
||||
else:
|
||||
await interaction.response.send_message(embed=embed, ephemeral=ephemeral)
|
||||
await interaction.response.send_message(
|
||||
embed=embed, ephemeral=ephemeral
|
||||
)
|
||||
else:
|
||||
await context.send(embed=embed)
|
||||
|
||||
@@ -40,7 +44,9 @@ class Sync(commands.Cog, name="sync"):
|
||||
description="Slash commands have been globally synchronized.",
|
||||
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"
|
||||
)
|
||||
await self.send_embed(context, embed)
|
||||
return
|
||||
elif scope == "guild":
|
||||
@@ -51,7 +57,9 @@ class Sync(commands.Cog, name="sync"):
|
||||
description="Slash commands have been synchronized in this guild.",
|
||||
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"
|
||||
)
|
||||
await self.send_embed(context, embed)
|
||||
return
|
||||
embed = discord.Embed(
|
||||
@@ -59,7 +67,9 @@ class Sync(commands.Cog, name="sync"):
|
||||
description="The scope must be `global` or `guild`.",
|
||||
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)
|
||||
|
||||
@commands.hybrid_command(
|
||||
@@ -87,7 +97,9 @@ class Sync(commands.Cog, name="sync"):
|
||||
description="Slash commands have been globally unsynchronized.",
|
||||
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"
|
||||
)
|
||||
await self.send_embed(context, embed)
|
||||
return
|
||||
elif scope == "guild":
|
||||
@@ -98,7 +110,9 @@ class Sync(commands.Cog, name="sync"):
|
||||
description="Slash commands have been unsynchronized in this guild.",
|
||||
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"
|
||||
)
|
||||
await self.send_embed(context, embed)
|
||||
return
|
||||
embed = discord.Embed(
|
||||
@@ -106,10 +120,11 @@ class Sync(commands.Cog, name="sync"):
|
||||
description="The scope must be `global` or `guild`.",
|
||||
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)
|
||||
|
||||
|
||||
async def cog_command_error(self, context: Context, error) -> None:
|
||||
if isinstance(error, commands.NotOwner):
|
||||
embed = discord.Embed(
|
||||
@@ -117,7 +132,9 @@ class Sync(commands.Cog, name="sync"):
|
||||
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