1
0
forked from sass/tipibot

Fix conflict

This commit is contained in:
Rene Arumetsa
2026-06-03 18:38:40 +03:00
parent 3939c879c9
commit 25cf60d2e1
2 changed files with 0 additions and 21 deletions

5
bot.py
View File

@@ -594,12 +594,7 @@ class HelpSelect(discord.ui.Select):
@tree.command(name="help", description=S.CMD["help"]) @tree.command(name="help", description=S.CMD["help"])
async def cmd_help(interaction: discord.Interaction): async def cmd_help(interaction: discord.Interaction):
<<<<<<< HEAD
is_admin = is_bot_admin(interaction.user) is_admin = is_bot_admin(interaction.user)
=======
member = interaction.user
is_admin = isinstance(member, discord.Member) and is_bot_admin(member)
>>>>>>> 42f7bae68124fa6a9824780ba17b46d00f3f2b36
await interaction.response.send_message( await interaction.response.send_message(
embed=_help_embed("üldine"), view=HelpView(is_admin), ephemeral=True embed=_help_embed("üldine"), view=HelpView(is_admin), ephemeral=True
) )

View File

@@ -6,15 +6,10 @@ from discord import app_commands
import config import config
<<<<<<< HEAD
def is_bot_admin(member: discord.abc.User | None) -> bool: def is_bot_admin(member: discord.abc.User | None) -> bool:
"""True when the member has the configured admin role for their guild.""" """True when the member has the configured admin role for their guild."""
if not isinstance(member, discord.Member) or member.guild is None: if not isinstance(member, discord.Member) or member.guild is None:
return False return False
=======
def is_bot_admin(member: discord.Member) -> bool:
"""Return True if the member has the configured bot-admin role for their guild."""
>>>>>>> 42f7bae68124fa6a9824780ba17b46d00f3f2b36
role_id = config.BOT_ADMIN_ROLES.get(member.guild.id) role_id = config.BOT_ADMIN_ROLES.get(member.guild.id)
if role_id is None: if role_id is None:
return False return False
@@ -22,22 +17,11 @@ def is_bot_admin(member: discord.Member) -> bool:
def bot_admin_check(): def bot_admin_check():
<<<<<<< HEAD
"""Slash-command decorator that gates execution behind ``is_bot_admin``.""" """Slash-command decorator that gates execution behind ``is_bot_admin``."""
async def predicate(interaction: discord.Interaction) -> bool: async def predicate(interaction: discord.Interaction) -> bool:
if is_bot_admin(interaction.user): if is_bot_admin(interaction.user):
return True return True
raise app_commands.MissingPermissions(["bot_admin_role"]) raise app_commands.MissingPermissions(["bot_admin_role"])
=======
"""Slash-command check decorator: raises MissingPermissions if not a bot admin."""
def predicate(interaction: discord.Interaction) -> bool:
member = interaction.user
if not isinstance(member, discord.Member):
raise app_commands.MissingPermissions(["bot_admin"])
if not is_bot_admin(member):
raise app_commands.MissingPermissions(["bot_admin"])
return True
>>>>>>> 42f7bae68124fa6a9824780ba17b46d00f3f2b36
return app_commands.check(predicate) return app_commands.check(predicate)