fix: Simplify owner check logic in TerminalCog to use hardcoded owner ID

This commit is contained in:
Slipstream 2025-05-17 18:55:27 -06:00
parent a857e4103d
commit a6b1f6a1b3
Signed by: slipstream
GPG Key ID: 13E498CE010AC6FD

View File

@ -27,37 +27,9 @@ MAX_OUTPUT_LINES_PER_IMAGE = (IMG_HEIGHT - 2 * PADDING) // (FONT_SIZE + LINE_SPA
# --- Helper: Owner Check ---
async def is_owner_check(interaction: discord.Interaction) -> bool:
"""Checks if the interacting user is the bot owner."""
if interaction.client.application is None: # Should not happen in slash commands
await interaction.client.application_info() # Fetch if not cached
# Using application.owner for robust owner checking
# For single owner bots, bot.owner_id can also be used if set.
# For team bots, application.owner will be the team. You might need to check team members.
# For simplicity, assuming a single owner or the first team member if it's a team.
app_info = await interaction.client.application_info()
if app_info.team:
# If it's a team, you might want to check if interaction.user.id is in team members
# For this example, we'll consider the team owner (usually the creator)
# This logic might need adjustment based on how discord.py handles team owners.
# A simpler approach for a single-person owned bot: return interaction.user.id == app_info.owner.id
# However, app_info.owner can be a User or a Team.
if isinstance(app_info.owner, discord.User):
return interaction.user.id == app_info.owner.id
elif isinstance(app_info.owner, discord.Team):
# Check if the user is a member of the team, or the team owner
# For simplicity, let's check if the user is the team owner (first member often is)
# or any member of the team.
if app_info.owner.owner_id == interaction.user.id:
return True
for member in app_info.owner.members:
if member.id == interaction.user.id:
return True # Or apply specific roles
return False # Or restrict to only team owner
return False # Fallback
elif app_info.owner: # Single owner
return interaction.user.id == app_info.owner.id
return False # Should not be reached if bot is properly configured
"""Checks if the interacting user is the hardcoded bot owner."""
OWNER_ID = 452666956353503252 # Replace with your Discord user ID
return interaction.user.id == OWNER_ID
class TerminalCog(commands.Cog, name="Terminal"):