update blacklists (#1290)

This commit is contained in:
NotSoToothless
2026-05-30 10:23:03 -07:00
committed by GitHub
parent ec2209b5d0
commit 37c3e66d75
2 changed files with 15 additions and 2 deletions
+6
View File
@@ -181,6 +181,12 @@ set_bot(bot) # Register bot globally for other modules
register_stack_commands(bot) register_stack_commands(bot)
@bot.tree.error
async def on_app_command_error(interaction: discord.Interaction, error: app_commands.AppCommandError):
"""Fallback slash-command error handler for commands without local handlers."""
await permission_fail(interaction, error)
@bot.event @bot.event
async def on_ready(): async def on_ready():
+9 -2
View File
@@ -528,8 +528,8 @@ def is_blacklisted():
"""Return an app-command check that rejects blacklisted users or guilds. """Return an app-command check that rejects blacklisted users or guilds.
Blacklisted users come from the shared BLACKLIST.json (see Blacklisted users come from the shared BLACKLIST.json (see
``shared_store.check_user_blacklist``); entries there may be a plain id or ``shared_store.check_user_blacklist``); entries there may include an
``[id, reason]``. internal comment/name and an optional reason.
Raises: Raises:
BlacklistCheckFailure: If the guild or user is blacklisted, BlacklistCheckFailure: If the guild or user is blacklisted,
@@ -577,6 +577,13 @@ async def permission_fail(interaction: discord.Interaction, error):
lang = await guild_lang(interaction.guild_id) if interaction.guild_id else "en" lang = await guild_lang(interaction.guild_id) if interaction.guild_id else "en"
if isinstance(error, BlacklistCheckFailure): if isinstance(error, BlacklistCheckFailure):
reason = error.args[0] if error.args else None reason = error.args[0] if error.args else None
logging.warning(
"Blacklisted command attempt blocked: user_id=%s guild_id=%s command=%s reason=%r",
getattr(interaction.user, "id", None),
interaction.guild_id,
interaction.command.qualified_name if interaction.command else None,
reason,
)
desc = t(lang, "permission.blacklisted_desc") desc = t(lang, "permission.blacklisted_desc")
if reason: if reason:
desc += "\n" + t(lang, "permission.reason_line", reason=reason) desc += "\n" + t(lang, "permission.reason_line", reason=reason)