mirror of
https://github.com/neoarz/Syntrel.git
synced 2025-12-25 03:40:11 +01:00
chore: add permission checks
This commit is contained in:
@@ -186,12 +186,21 @@ class ideviceSelect(discord.ui.Select):
|
|||||||
await interaction.followup.send(embed=embed, view=view, ephemeral=True)
|
await interaction.followup.send(embed=embed, view=view, ephemeral=True)
|
||||||
|
|
||||||
except discord.Forbidden:
|
except discord.Forbidden:
|
||||||
self.bot.logger.warning(f"Bot missing permissions in server {interaction.guild.name} (ID: {interaction.guild.id}) - cannot execute errorcodes command")
|
guild_info = f"server {interaction.guild.name} (ID: {interaction.guild.id})" if interaction.guild else "DM or private channel"
|
||||||
embed = discord.Embed(
|
self.bot.logger.warning(f"Bot missing permissions in {guild_info} - cannot execute errorcodes command")
|
||||||
title="Permission Error",
|
|
||||||
description="The bot doesn't have the required permissions in this server to execute this command. Use the slash command `/errorcodes` instead.",
|
if interaction.guild is None:
|
||||||
color=0xFF0000
|
embed = discord.Embed(
|
||||||
)
|
title="Error",
|
||||||
|
description="This command cannot be executed in DMs.",
|
||||||
|
color=0xFF0000
|
||||||
|
)
|
||||||
|
else:
|
||||||
|
embed = discord.Embed(
|
||||||
|
title="Permission Error",
|
||||||
|
description="The bot needs the `send messages` permission to execute this command.",
|
||||||
|
color=0xFF0000
|
||||||
|
)
|
||||||
embed.set_author(name="idevice", icon_url="https://yes.nighty.works/raw/snLMuO.png")
|
embed.set_author(name="idevice", icon_url="https://yes.nighty.works/raw/snLMuO.png")
|
||||||
await interaction.response.edit_message(embed=embed, view=None)
|
await interaction.response.edit_message(embed=embed, view=None)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
@@ -220,12 +229,21 @@ class ideviceSelect(discord.ui.Select):
|
|||||||
embed.set_author(name="idevice", icon_url="https://yes.nighty.works/raw/snLMuO.png")
|
embed.set_author(name="idevice", icon_url="https://yes.nighty.works/raw/snLMuO.png")
|
||||||
await interaction.response.edit_message(embed=embed, view=None)
|
await interaction.response.edit_message(embed=embed, view=None)
|
||||||
except discord.Forbidden:
|
except discord.Forbidden:
|
||||||
self.bot.logger.warning(f"Bot missing permissions in server {interaction.guild.name} (ID: {interaction.guild.id}) - cannot execute {command_name} command")
|
guild_info = f"server {interaction.guild.name} (ID: {interaction.guild.id})" if interaction.guild else "DM or private channel"
|
||||||
embed = discord.Embed(
|
self.bot.logger.warning(f"Bot missing permissions in {guild_info} - cannot execute {command_name} command")
|
||||||
title="Permission Error",
|
|
||||||
description=f"The bot doesn't have the required permissions in this server to execute this command. Use the slash command `/{command_name}` instead.",
|
if interaction.guild is None:
|
||||||
color=0xFF0000
|
embed = discord.Embed(
|
||||||
)
|
title="Error",
|
||||||
|
description="This command cannot be executed in DMs.",
|
||||||
|
color=0xFF0000
|
||||||
|
)
|
||||||
|
else:
|
||||||
|
embed = discord.Embed(
|
||||||
|
title="Permission Error",
|
||||||
|
description="The bot needs the `send messages` permission to execute this command.",
|
||||||
|
color=0xFF0000
|
||||||
|
)
|
||||||
embed.set_author(name="idevice", icon_url="https://yes.nighty.works/raw/snLMuO.png")
|
embed.set_author(name="idevice", icon_url="https://yes.nighty.works/raw/snLMuO.png")
|
||||||
await interaction.response.edit_message(embed=embed, view=None)
|
await interaction.response.edit_message(embed=embed, view=None)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
@@ -258,6 +276,34 @@ def idevice_command():
|
|||||||
name="idevice", description="idevice troubleshooting and help"
|
name="idevice", description="idevice troubleshooting and help"
|
||||||
)
|
)
|
||||||
async def idevice(self, context):
|
async def idevice(self, context):
|
||||||
|
if isinstance(context.channel, discord.DMChannel):
|
||||||
|
embed = discord.Embed(
|
||||||
|
title="Error",
|
||||||
|
description="This command can only be used in servers.",
|
||||||
|
color=0xE02B2B,
|
||||||
|
)
|
||||||
|
embed.set_author(name="idevice", icon_url="https://yes.nighty.works/raw/snLMuO.png")
|
||||||
|
|
||||||
|
if context.interaction:
|
||||||
|
await context.interaction.response.send_message(embed=embed, ephemeral=True)
|
||||||
|
else:
|
||||||
|
await context.send(embed=embed, ephemeral=True)
|
||||||
|
return
|
||||||
|
|
||||||
|
if isinstance(context.channel, discord.PartialMessageable):
|
||||||
|
embed = discord.Embed(
|
||||||
|
title="Error",
|
||||||
|
description="The bot needs send messages permissions in this channel.",
|
||||||
|
color=0xE02B2B,
|
||||||
|
)
|
||||||
|
embed.set_author(name="idevice", icon_url="https://yes.nighty.works/raw/snLMuO.png")
|
||||||
|
|
||||||
|
if context.interaction:
|
||||||
|
await context.interaction.response.send_message(embed=embed, ephemeral=True)
|
||||||
|
else:
|
||||||
|
await context.send(embed=embed, ephemeral=True)
|
||||||
|
return
|
||||||
|
|
||||||
embed = discord.Embed(
|
embed = discord.Embed(
|
||||||
title="idevice Commands",
|
title="idevice Commands",
|
||||||
description="Choose a command from the dropdown below to get help with specific issues:",
|
description="Choose a command from the dropdown below to get help with specific issues:",
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ def download_command():
|
|||||||
if isinstance(context.channel, discord.PartialMessageable):
|
if isinstance(context.channel, discord.PartialMessageable):
|
||||||
embed = discord.Embed(
|
embed = discord.Embed(
|
||||||
title="Error",
|
title="Error",
|
||||||
description="The bot needs send messages permissions in this channel.",
|
description="The bot needs the `send messages` permission in this channel.",
|
||||||
color=0xE02B2B,
|
color=0xE02B2B,
|
||||||
)
|
)
|
||||||
embed.set_author(name="Media", icon_url="https://yes.nighty.works/raw/y5SEZ9.webp")
|
embed.set_author(name="Media", icon_url="https://yes.nighty.works/raw/y5SEZ9.webp")
|
||||||
@@ -208,16 +208,36 @@ def download_command():
|
|||||||
embed.set_footer(text=f"Requested by {context.author.name}", icon_url=context.author.display_avatar.url)
|
embed.set_footer(text=f"Requested by {context.author.name}", icon_url=context.author.display_avatar.url)
|
||||||
|
|
||||||
if interaction is not None:
|
if interaction is not None:
|
||||||
await context.channel.send(embed=embed)
|
|
||||||
await context.channel.send(link)
|
|
||||||
try:
|
try:
|
||||||
await interaction.delete_original_response()
|
await context.channel.send(embed=embed)
|
||||||
except:
|
await context.channel.send(link)
|
||||||
pass
|
try:
|
||||||
|
await interaction.delete_original_response()
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
except discord.Forbidden:
|
||||||
|
embed = discord.Embed(
|
||||||
|
title="Permission Error",
|
||||||
|
description="The bot needs the `send messages` permission to execute this command.",
|
||||||
|
color=0xE02B2B,
|
||||||
|
)
|
||||||
|
embed.set_author(name="Media", icon_url="https://yes.nighty.works/raw/y5SEZ9.webp")
|
||||||
|
await interaction.followup.send(embed=embed, ephemeral=True)
|
||||||
|
return
|
||||||
else:
|
else:
|
||||||
await processing_msg.delete()
|
try:
|
||||||
await context.channel.send(embed=embed)
|
await processing_msg.delete()
|
||||||
await context.channel.send(link)
|
await context.channel.send(embed=embed)
|
||||||
|
await context.channel.send(link)
|
||||||
|
except discord.Forbidden:
|
||||||
|
embed = discord.Embed(
|
||||||
|
title="Permission Error",
|
||||||
|
description="The bot needs the `send messages` permission to execute this command.",
|
||||||
|
color=0xE02B2B,
|
||||||
|
)
|
||||||
|
embed.set_author(name="Media", icon_url="https://yes.nighty.works/raw/y5SEZ9.webp")
|
||||||
|
await context.send(embed=embed, ephemeral=True)
|
||||||
|
return
|
||||||
return
|
return
|
||||||
except Exception as upload_error:
|
except Exception as upload_error:
|
||||||
logger.exception(f"Catbox upload exception: {upload_error}")
|
logger.exception(f"Catbox upload exception: {upload_error}")
|
||||||
@@ -265,16 +285,36 @@ def download_command():
|
|||||||
file = discord.File(f, filename=files[0])
|
file = discord.File(f, filename=files[0])
|
||||||
|
|
||||||
if interaction is not None:
|
if interaction is not None:
|
||||||
await context.channel.send(embed=embed)
|
|
||||||
await context.channel.send(file=file)
|
|
||||||
try:
|
try:
|
||||||
await interaction.delete_original_response()
|
await context.channel.send(embed=embed)
|
||||||
except:
|
await context.channel.send(file=file)
|
||||||
pass
|
try:
|
||||||
|
await interaction.delete_original_response()
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
except discord.Forbidden:
|
||||||
|
embed = discord.Embed(
|
||||||
|
title="Permission Error",
|
||||||
|
description="The bot needs the `send messages` permission to execute this command.",
|
||||||
|
color=0xE02B2B,
|
||||||
|
)
|
||||||
|
embed.set_author(name="Media", icon_url="https://yes.nighty.works/raw/y5SEZ9.webp")
|
||||||
|
await interaction.followup.send(embed=embed, ephemeral=True)
|
||||||
|
return
|
||||||
else:
|
else:
|
||||||
await processing_msg.delete()
|
try:
|
||||||
await context.channel.send(embed=embed)
|
await processing_msg.delete()
|
||||||
await context.channel.send(file=file)
|
await context.channel.send(embed=embed)
|
||||||
|
await context.channel.send(file=file)
|
||||||
|
except discord.Forbidden:
|
||||||
|
embed = discord.Embed(
|
||||||
|
title="Permission Error",
|
||||||
|
description="The bot needs the `send messages` permission to execute this command.",
|
||||||
|
color=0xE02B2B,
|
||||||
|
)
|
||||||
|
embed.set_author(name="Media", icon_url="https://yes.nighty.works/raw/y5SEZ9.webp")
|
||||||
|
await context.send(embed=embed, ephemeral=True)
|
||||||
|
return
|
||||||
except discord.HTTPException as e:
|
except discord.HTTPException as e:
|
||||||
if e.status == 413:
|
if e.status == 413:
|
||||||
logger.info("Discord rejected file (413), falling back to Catbox upload")
|
logger.info("Discord rejected file (413), falling back to Catbox upload")
|
||||||
@@ -313,16 +353,36 @@ def download_command():
|
|||||||
embed.set_footer(text=f"Requested by {context.author.name}", icon_url=context.author.display_avatar.url)
|
embed.set_footer(text=f"Requested by {context.author.name}", icon_url=context.author.display_avatar.url)
|
||||||
|
|
||||||
if interaction is not None:
|
if interaction is not None:
|
||||||
await context.channel.send(embed=embed)
|
|
||||||
await context.channel.send(link)
|
|
||||||
try:
|
try:
|
||||||
await interaction.delete_original_response()
|
await context.channel.send(embed=embed)
|
||||||
except:
|
await context.channel.send(link)
|
||||||
pass
|
try:
|
||||||
|
await interaction.delete_original_response()
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
except discord.Forbidden:
|
||||||
|
embed = discord.Embed(
|
||||||
|
title="Permission Error",
|
||||||
|
description="The bot needs the `send messages` permission to execute this command.",
|
||||||
|
color=0xE02B2B,
|
||||||
|
)
|
||||||
|
embed.set_author(name="Media", icon_url="https://yes.nighty.works/raw/y5SEZ9.webp")
|
||||||
|
await interaction.followup.send(embed=embed, ephemeral=True)
|
||||||
|
return
|
||||||
else:
|
else:
|
||||||
await processing_msg.delete()
|
try:
|
||||||
await context.channel.send(embed=embed)
|
await processing_msg.delete()
|
||||||
await context.channel.send(link)
|
await context.channel.send(embed=embed)
|
||||||
|
await context.channel.send(link)
|
||||||
|
except discord.Forbidden:
|
||||||
|
embed = discord.Embed(
|
||||||
|
title="Permission Error",
|
||||||
|
description="The bot needs the `send messages` permission to execute this command.",
|
||||||
|
color=0xE02B2B,
|
||||||
|
)
|
||||||
|
embed.set_author(name="Media", icon_url="https://yes.nighty.works/raw/y5SEZ9.webp")
|
||||||
|
await context.send(embed=embed, ephemeral=True)
|
||||||
|
return
|
||||||
except Exception as upload_error:
|
except Exception as upload_error:
|
||||||
logger.exception(f"Catbox upload exception: {upload_error}")
|
logger.exception(f"Catbox upload exception: {upload_error}")
|
||||||
embed = discord.Embed(
|
embed = discord.Embed(
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ def mcquote_command():
|
|||||||
if isinstance(context.channel, discord.PartialMessageable):
|
if isinstance(context.channel, discord.PartialMessageable):
|
||||||
embed = discord.Embed(
|
embed = discord.Embed(
|
||||||
title="Error",
|
title="Error",
|
||||||
description="The bot needs send messages permissions in this channel.",
|
description="The bot needs the `send messages` permission in this channel.",
|
||||||
color=0xE02B2B,
|
color=0xE02B2B,
|
||||||
)
|
)
|
||||||
embed.set_author(name="Media", icon_url="https://yes.nighty.works/raw/y5SEZ9.webp")
|
embed.set_author(name="Media", icon_url="https://yes.nighty.works/raw/y5SEZ9.webp")
|
||||||
@@ -127,16 +127,36 @@ def mcquote_command():
|
|||||||
|
|
||||||
interaction = getattr(context, "interaction", None)
|
interaction = getattr(context, "interaction", None)
|
||||||
if interaction is not None:
|
if interaction is not None:
|
||||||
await context.channel.send(embed=embed)
|
|
||||||
await context.channel.send(file=file)
|
|
||||||
try:
|
try:
|
||||||
await interaction.delete_original_response()
|
await context.channel.send(embed=embed)
|
||||||
except:
|
await context.channel.send(file=file)
|
||||||
pass
|
try:
|
||||||
|
await interaction.delete_original_response()
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
except discord.Forbidden:
|
||||||
|
embed = discord.Embed(
|
||||||
|
title="Permission Error",
|
||||||
|
description="The bot needs the `send messages` permission to execute this command.",
|
||||||
|
color=0xE02B2B,
|
||||||
|
)
|
||||||
|
embed.set_author(name="Media", icon_url="https://yes.nighty.works/raw/y5SEZ9.webp")
|
||||||
|
await interaction.followup.send(embed=embed, ephemeral=True)
|
||||||
|
return
|
||||||
else:
|
else:
|
||||||
await processing_msg.delete()
|
try:
|
||||||
await context.channel.send(embed=embed)
|
await processing_msg.delete()
|
||||||
await context.channel.send(file=file)
|
await context.channel.send(embed=embed)
|
||||||
|
await context.channel.send(file=file)
|
||||||
|
except discord.Forbidden:
|
||||||
|
embed = discord.Embed(
|
||||||
|
title="Permission Error",
|
||||||
|
description="The bot needs the `send messages` permission to execute this command.",
|
||||||
|
color=0xE02B2B,
|
||||||
|
)
|
||||||
|
embed.set_author(name="Media", icon_url="https://yes.nighty.works/raw/y5SEZ9.webp")
|
||||||
|
await context.send(embed=embed, ephemeral=True)
|
||||||
|
return
|
||||||
|
|
||||||
os.remove(temp_file_path)
|
os.remove(temp_file_path)
|
||||||
except aiohttp.ClientError:
|
except aiohttp.ClientError:
|
||||||
|
|||||||
@@ -85,7 +85,7 @@ def tts_command():
|
|||||||
if isinstance(context.channel, discord.PartialMessageable):
|
if isinstance(context.channel, discord.PartialMessageable):
|
||||||
embed = discord.Embed(
|
embed = discord.Embed(
|
||||||
title="Error",
|
title="Error",
|
||||||
description="The bot needs send messages permissions in this channel.",
|
description="The bot needs the `send messages` permission in this channel.",
|
||||||
color=0xE02B2B,
|
color=0xE02B2B,
|
||||||
)
|
)
|
||||||
embed.set_author(name="Media", icon_url="https://yes.nighty.works/raw/y5SEZ9.webp")
|
embed.set_author(name="Media", icon_url="https://yes.nighty.works/raw/y5SEZ9.webp")
|
||||||
@@ -198,15 +198,35 @@ def tts_command():
|
|||||||
)
|
)
|
||||||
|
|
||||||
if interaction is not None:
|
if interaction is not None:
|
||||||
await context.channel.send(embed=embed)
|
|
||||||
await context.channel.send(file=audio_file)
|
|
||||||
try:
|
try:
|
||||||
await interaction.delete_original_response()
|
await context.channel.send(embed=embed)
|
||||||
except:
|
await context.channel.send(file=audio_file)
|
||||||
pass
|
try:
|
||||||
|
await interaction.delete_original_response()
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
except discord.Forbidden:
|
||||||
|
embed = discord.Embed(
|
||||||
|
title="Permission Error",
|
||||||
|
description="The bot needs the `send messages` permission to execute this command.",
|
||||||
|
color=0xE02B2B,
|
||||||
|
)
|
||||||
|
embed.set_author(name="Media", icon_url="https://yes.nighty.works/raw/y5SEZ9.webp")
|
||||||
|
await interaction.followup.send(embed=embed, ephemeral=True)
|
||||||
|
return
|
||||||
else:
|
else:
|
||||||
await processing_message.delete()
|
try:
|
||||||
await context.channel.send(embed=embed)
|
await processing_message.delete()
|
||||||
await context.channel.send(file=audio_file)
|
await context.channel.send(embed=embed)
|
||||||
|
await context.channel.send(file=audio_file)
|
||||||
|
except discord.Forbidden:
|
||||||
|
embed = discord.Embed(
|
||||||
|
title="Permission Error",
|
||||||
|
description="The bot needs the `send messages` permission to execute this command.",
|
||||||
|
color=0xE02B2B,
|
||||||
|
)
|
||||||
|
embed.set_author(name="Media", icon_url="https://yes.nighty.works/raw/y5SEZ9.webp")
|
||||||
|
await context.send(embed=embed, ephemeral=True)
|
||||||
|
return
|
||||||
|
|
||||||
return tts
|
return tts
|
||||||
@@ -63,12 +63,21 @@ class MelonxSelect(discord.ui.Select):
|
|||||||
embed.set_author(name="MeloNX", icon_url="https://yes.nighty.works/raw/TLGaVa.png")
|
embed.set_author(name="MeloNX", icon_url="https://yes.nighty.works/raw/TLGaVa.png")
|
||||||
await interaction.response.edit_message(embed=embed, view=None)
|
await interaction.response.edit_message(embed=embed, view=None)
|
||||||
except discord.Forbidden:
|
except discord.Forbidden:
|
||||||
self.bot.logger.warning(f"Bot missing permissions in server {interaction.guild.name} (ID: {interaction.guild.id}) - cannot execute {command_name} command")
|
guild_info = f"server {interaction.guild.name} (ID: {interaction.guild.id})" if interaction.guild else "DM or private channel"
|
||||||
embed = discord.Embed(
|
self.bot.logger.warning(f"Bot missing permissions in {guild_info} - cannot execute {command_name} command")
|
||||||
title="Permission Error",
|
|
||||||
description="The bot doesn't have the required permissions in this server to execute this command. Use the slash command `/{command_name}` instead.",
|
if interaction.guild is None:
|
||||||
color=0x963155
|
embed = discord.Embed(
|
||||||
)
|
title="Error",
|
||||||
|
description="This command cannot be executed in DMs.",
|
||||||
|
color=0xFF0000
|
||||||
|
)
|
||||||
|
else:
|
||||||
|
embed = discord.Embed(
|
||||||
|
title="Permission Error",
|
||||||
|
description="The bot needs the `send messages` permission to execute this command.",
|
||||||
|
color=0xFF0000
|
||||||
|
)
|
||||||
embed.set_author(name="MeloNX", icon_url="https://yes.nighty.works/raw/TLGaVa.png")
|
embed.set_author(name="MeloNX", icon_url="https://yes.nighty.works/raw/TLGaVa.png")
|
||||||
await interaction.response.edit_message(embed=embed, view=None)
|
await interaction.response.edit_message(embed=embed, view=None)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
@@ -94,3 +103,53 @@ class MelonxView(discord.ui.View):
|
|||||||
def __init__(self, bot):
|
def __init__(self, bot):
|
||||||
super().__init__()
|
super().__init__()
|
||||||
self.add_item(MelonxSelect(bot))
|
self.add_item(MelonxSelect(bot))
|
||||||
|
|
||||||
|
|
||||||
|
def melonx_command():
|
||||||
|
@commands.hybrid_command(
|
||||||
|
name="melonx", description="MeloNX troubleshooting and help"
|
||||||
|
)
|
||||||
|
async def melonx(self, context):
|
||||||
|
if isinstance(context.channel, discord.DMChannel):
|
||||||
|
embed = discord.Embed(
|
||||||
|
title="Error",
|
||||||
|
description="This command can only be used in servers.",
|
||||||
|
color=0xE02B2B,
|
||||||
|
)
|
||||||
|
embed.set_author(name="MeloNX", icon_url="https://yes.nighty.works/raw/TLGaVa.png")
|
||||||
|
|
||||||
|
if context.interaction:
|
||||||
|
await context.interaction.response.send_message(embed=embed, ephemeral=True)
|
||||||
|
else:
|
||||||
|
await context.send(embed=embed, ephemeral=True)
|
||||||
|
return
|
||||||
|
|
||||||
|
if isinstance(context.channel, discord.PartialMessageable):
|
||||||
|
embed = discord.Embed(
|
||||||
|
title="Error",
|
||||||
|
description="The bot needs send messages permissions in this channel.",
|
||||||
|
color=0xE02B2B,
|
||||||
|
)
|
||||||
|
embed.set_author(name="MeloNX", icon_url="https://yes.nighty.works/raw/TLGaVa.png")
|
||||||
|
|
||||||
|
if context.interaction:
|
||||||
|
await context.interaction.response.send_message(embed=embed, ephemeral=True)
|
||||||
|
else:
|
||||||
|
await context.send(embed=embed, ephemeral=True)
|
||||||
|
return
|
||||||
|
|
||||||
|
embed = discord.Embed(
|
||||||
|
title="MeloNX Commands",
|
||||||
|
description="Choose a command from the dropdown below to get help with specific issues:",
|
||||||
|
color=0x963155
|
||||||
|
)
|
||||||
|
embed.set_author(name="MeloNX", icon_url="https://yes.nighty.works/raw/TLGaVa.png")
|
||||||
|
|
||||||
|
view = MelonxView(self.bot)
|
||||||
|
|
||||||
|
if context.interaction:
|
||||||
|
await context.interaction.response.send_message(embed=embed, view=view, ephemeral=True)
|
||||||
|
else:
|
||||||
|
await context.send(embed=embed, view=view)
|
||||||
|
|
||||||
|
return melonx
|
||||||
|
|||||||
@@ -74,12 +74,21 @@ class SidestoreSelect(discord.ui.Select):
|
|||||||
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)
|
await interaction.response.edit_message(embed=embed, view=None)
|
||||||
except discord.Forbidden:
|
except discord.Forbidden:
|
||||||
self.bot.logger.warning(f"Bot missing permissions in server {interaction.guild.name} (ID: {interaction.guild.id}) - cannot execute {command_name} command")
|
guild_info = f"server {interaction.guild.name} (ID: {interaction.guild.id})" if interaction.guild else "DM or private channel"
|
||||||
embed = discord.Embed(
|
self.bot.logger.warning(f"Bot missing permissions in {guild_info} - cannot execute {command_name} command")
|
||||||
title="Permission Error",
|
|
||||||
description="The bot doesn't have the required permissions in this server to execute this command. Use the slash command `/{command_name}` instead.",
|
if interaction.guild is None:
|
||||||
color=0xFF0000
|
embed = discord.Embed(
|
||||||
)
|
title="Error",
|
||||||
|
description="This command cannot be executed in DMs.",
|
||||||
|
color=0xFF0000
|
||||||
|
)
|
||||||
|
else:
|
||||||
|
embed = discord.Embed(
|
||||||
|
title="Permission Error",
|
||||||
|
description="The bot needs the `send messages` permission to execute this command.",
|
||||||
|
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)
|
await interaction.response.edit_message(embed=embed, view=None)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
@@ -112,6 +121,34 @@ def sidestore_command():
|
|||||||
name="help", description="SideStore troubleshooting and help"
|
name="help", description="SideStore troubleshooting and help"
|
||||||
)
|
)
|
||||||
async def sidestore(self, context):
|
async def sidestore(self, context):
|
||||||
|
if isinstance(context.channel, discord.DMChannel):
|
||||||
|
embed = discord.Embed(
|
||||||
|
title="Error",
|
||||||
|
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")
|
||||||
|
|
||||||
|
if context.interaction:
|
||||||
|
await context.interaction.response.send_message(embed=embed, ephemeral=True)
|
||||||
|
else:
|
||||||
|
await context.send(embed=embed, ephemeral=True)
|
||||||
|
return
|
||||||
|
|
||||||
|
if isinstance(context.channel, discord.PartialMessageable):
|
||||||
|
embed = discord.Embed(
|
||||||
|
title="Error",
|
||||||
|
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")
|
||||||
|
|
||||||
|
if context.interaction:
|
||||||
|
await context.interaction.response.send_message(embed=embed, ephemeral=True)
|
||||||
|
else:
|
||||||
|
await context.send(embed=embed, ephemeral=True)
|
||||||
|
return
|
||||||
|
|
||||||
embed = discord.Embed(
|
embed = discord.Embed(
|
||||||
title="SideStore Commands",
|
title="SideStore Commands",
|
||||||
description="Choose a command from the dropdown below to get help with specific issues:",
|
description="Choose a command from the dropdown below to get help with specific issues:",
|
||||||
|
|||||||
Reference in New Issue
Block a user