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:
@@ -53,14 +53,14 @@ class SidestoreSelect(discord.ui.Select):
|
||||
label="UDID Error",
|
||||
value="udid",
|
||||
description="SideStore could not determine device UDID",
|
||||
)
|
||||
),
|
||||
]
|
||||
super().__init__(placeholder="Choose a SideStore command...", options=options)
|
||||
|
||||
async def callback(self, interaction: discord.Interaction):
|
||||
command_name = self.values[0]
|
||||
command = self.bot.get_command(command_name)
|
||||
|
||||
|
||||
if command:
|
||||
try:
|
||||
ctx = await self.bot.get_context(interaction.message)
|
||||
@@ -69,44 +69,60 @@ class SidestoreSelect(discord.ui.Select):
|
||||
embed = discord.Embed(
|
||||
title="Command Executed",
|
||||
description=f"Successfully executed `/{command_name}`",
|
||||
color=0x00FF00
|
||||
color=0x00FF00,
|
||||
)
|
||||
embed.set_author(
|
||||
name="SideStore",
|
||||
icon_url="https://github.com/SideStore/assets/blob/main/icons/classic/Default.png?raw=true",
|
||||
)
|
||||
embed.set_author(name="SideStore", icon_url="https://github.com/SideStore/assets/blob/main/icons/classic/Default.png?raw=true")
|
||||
await interaction.response.edit_message(embed=embed, view=None)
|
||||
except discord.Forbidden:
|
||||
guild_info = f"server {interaction.guild.name} (ID: {interaction.guild.id})" if interaction.guild else "DM or private channel"
|
||||
self.bot.logger.warning(f"Bot missing permissions in {guild_info} - cannot execute {command_name} command")
|
||||
|
||||
guild_info = (
|
||||
f"server {interaction.guild.name} (ID: {interaction.guild.id})"
|
||||
if interaction.guild
|
||||
else "DM or private channel"
|
||||
)
|
||||
self.bot.logger.warning(
|
||||
f"Bot missing permissions in {guild_info} - cannot execute {command_name} command"
|
||||
)
|
||||
|
||||
if interaction.guild is None:
|
||||
embed = discord.Embed(
|
||||
title="Error",
|
||||
description="This command cannot be executed in DMs.",
|
||||
color=0xFF0000
|
||||
color=0xFF0000,
|
||||
)
|
||||
else:
|
||||
embed = discord.Embed(
|
||||
title="Permission Error",
|
||||
description="The bot needs the `send messages` permission to execute this command.",
|
||||
color=0xFF0000
|
||||
color=0xFF0000,
|
||||
)
|
||||
embed.set_author(name="SideStore", icon_url="https://github.com/SideStore/assets/blob/main/icons/classic/Default.png?raw=true")
|
||||
embed.set_author(
|
||||
name="SideStore",
|
||||
icon_url="https://github.com/SideStore/assets/blob/main/icons/classic/Default.png?raw=true",
|
||||
)
|
||||
await interaction.response.edit_message(embed=embed, view=None)
|
||||
except Exception as e:
|
||||
self.bot.logger.error(f"Error executing {command_name} command: {e}")
|
||||
embed = discord.Embed(
|
||||
title="Error",
|
||||
description="An error occurred while executing the command.",
|
||||
color=0xFF0000
|
||||
color=0xFF0000,
|
||||
)
|
||||
embed.set_author(
|
||||
name="SideStore",
|
||||
icon_url="https://github.com/SideStore/assets/blob/main/icons/classic/Default.png?raw=true",
|
||||
)
|
||||
embed.set_author(name="SideStore", icon_url="https://github.com/SideStore/assets/blob/main/icons/classic/Default.png?raw=true")
|
||||
await interaction.response.edit_message(embed=embed, view=None)
|
||||
else:
|
||||
embed = discord.Embed(
|
||||
title="Error",
|
||||
description="Command not found!",
|
||||
color=0xFF0000
|
||||
title="Error", description="Command not found!", color=0xFF0000
|
||||
)
|
||||
embed.set_author(
|
||||
name="SideStore",
|
||||
icon_url="https://github.com/SideStore/assets/blob/main/icons/classic/Default.png?raw=true",
|
||||
)
|
||||
embed.set_author(name="SideStore", icon_url="https://github.com/SideStore/assets/blob/main/icons/classic/Default.png?raw=true")
|
||||
await interaction.response.edit_message(embed=embed, view=None)
|
||||
|
||||
|
||||
@@ -127,10 +143,15 @@ def sidestore_command():
|
||||
description="This command can only be used in servers.",
|
||||
color=0xE02B2B,
|
||||
)
|
||||
embed.set_author(name="SideStore", icon_url="https://github.com/SideStore/assets/blob/main/icons/classic/Default.png?raw=true")
|
||||
|
||||
embed.set_author(
|
||||
name="SideStore",
|
||||
icon_url="https://github.com/SideStore/assets/blob/main/icons/classic/Default.png?raw=true",
|
||||
)
|
||||
|
||||
if context.interaction:
|
||||
await context.interaction.response.send_message(embed=embed, ephemeral=True)
|
||||
await context.interaction.response.send_message(
|
||||
embed=embed, ephemeral=True
|
||||
)
|
||||
else:
|
||||
await context.send(embed=embed, ephemeral=True)
|
||||
return
|
||||
@@ -141,10 +162,15 @@ def sidestore_command():
|
||||
description="The bot needs send messages permissions in this channel.",
|
||||
color=0xE02B2B,
|
||||
)
|
||||
embed.set_author(name="SideStore", icon_url="https://github.com/SideStore/assets/blob/main/icons/classic/Default.png?raw=true")
|
||||
|
||||
embed.set_author(
|
||||
name="SideStore",
|
||||
icon_url="https://github.com/SideStore/assets/blob/main/icons/classic/Default.png?raw=true",
|
||||
)
|
||||
|
||||
if context.interaction:
|
||||
await context.interaction.response.send_message(embed=embed, ephemeral=True)
|
||||
await context.interaction.response.send_message(
|
||||
embed=embed, ephemeral=True
|
||||
)
|
||||
else:
|
||||
await context.send(embed=embed, ephemeral=True)
|
||||
return
|
||||
@@ -152,15 +178,20 @@ def sidestore_command():
|
||||
embed = discord.Embed(
|
||||
title="SideStore Commands",
|
||||
description="Choose a command from the dropdown below to get help with specific issues:",
|
||||
color=0x8e82f9
|
||||
color=0x8E82F9,
|
||||
)
|
||||
embed.set_author(name="SideStore", icon_url="https://github.com/SideStore/assets/blob/main/icons/classic/Default.png?raw=true")
|
||||
|
||||
embed.set_author(
|
||||
name="SideStore",
|
||||
icon_url="https://github.com/SideStore/assets/blob/main/icons/classic/Default.png?raw=true",
|
||||
)
|
||||
|
||||
view = SidestoreView(self.bot)
|
||||
|
||||
|
||||
if context.interaction:
|
||||
await context.interaction.response.send_message(embed=embed, view=view, ephemeral=True)
|
||||
await context.interaction.response.send_message(
|
||||
embed=embed, view=view, ephemeral=True
|
||||
)
|
||||
else:
|
||||
await context.send(embed=embed, view=view)
|
||||
|
||||
|
||||
return sidestore
|
||||
|
||||
Reference in New Issue
Block a user