blacklist DSPL 💔 (#1293)
This commit is contained in:
+4
-2
@@ -42,7 +42,7 @@ from .utils import (
|
||||
replay_session_dir,
|
||||
SQ_BATTLES_DB_PATH,
|
||||
SQUADRONS_DB_PATH,
|
||||
BLACKLISTED_SERVER_IDS,
|
||||
blacklisted_guilds,
|
||||
DEFAULT_FOOTER_CAT,
|
||||
compress_json,
|
||||
decompress_json,
|
||||
@@ -768,6 +768,8 @@ async def prune_invalid_channels(bot, mapping: dict[str, tuple[dict, list[tuple]
|
||||
pruning so the dispatch step can decide between a real scoreboard and an
|
||||
over-cap/wildcard-blocked warning.
|
||||
"""
|
||||
blacklist = blacklisted_guilds()
|
||||
|
||||
for sid in list(mapping):
|
||||
game, targets = mapping[sid]
|
||||
valid_targets: list[tuple] = []
|
||||
@@ -787,7 +789,7 @@ async def prune_invalid_channels(bot, mapping: dict[str, tuple[dict, list[tuple]
|
||||
continue
|
||||
|
||||
# Drop any target from a blacklisted server
|
||||
if guild.id in BLACKLISTED_SERVER_IDS:
|
||||
if guild.id in blacklist:
|
||||
continue
|
||||
|
||||
# Check channel exists in Discord
|
||||
|
||||
@@ -32,7 +32,7 @@ from .utils import (
|
||||
STORAGE_DIR,
|
||||
SQUADRONS_DB_PATH,
|
||||
SQ_BATTLES_DB_PATH,
|
||||
BLACKLISTED_SERVER_IDS,
|
||||
blacklisted_guilds,
|
||||
DEFAULT_FOOTER_CAT,
|
||||
compress_json,
|
||||
discord_len,
|
||||
@@ -1034,11 +1034,12 @@ async def execute_points_alarm_task(region: str):
|
||||
# Step 1: Collect squadron -> [(guild_id, channel_str, flag)] mappings
|
||||
# flag: "ok" (dispatch normal) | "over_cap" (send orange upgrade warning)
|
||||
squadron_channels: dict[str, list[tuple[int, str, str, str]]] = {}
|
||||
blacklist = blacklisted_guilds()
|
||||
|
||||
for guild in bot.guilds:
|
||||
guild_id = guild.id
|
||||
|
||||
if guild_id in BLACKLISTED_SERVER_IDS:
|
||||
if guild_id in blacklist:
|
||||
continue
|
||||
|
||||
prefs_path = PREFS_DIR / f"{guild_id}-preferences.json"
|
||||
|
||||
+10
-11
@@ -34,7 +34,7 @@ from wcwidth import wcswidth
|
||||
# BOT/__init__.py has already put BOTS/SHARED on sys.path; re-export it
|
||||
# under a public name so peer modules can use it for asset paths.
|
||||
from . import SHARED_DIR # noqa: F401 — re-exported for siblings
|
||||
from shared_store import check_user_blacklist
|
||||
from shared_store import check_user_blacklist, blacklisted_guilds
|
||||
from data_parser import (
|
||||
LangTableReader,
|
||||
UnitTags,
|
||||
@@ -127,12 +127,10 @@ def decompress_json(data):
|
||||
# BLACKLISTS
|
||||
# ============================================================================
|
||||
|
||||
BLACKLISTED_SERVER_IDS = [
|
||||
]
|
||||
|
||||
# Blacklisted users and squadrons now live in the shared, version-controlled
|
||||
# BOTS/SHARED/BLACKLIST.json (read via shared_store) so both bots share one
|
||||
# source of truth. Use check_user_blacklist() / shared_store.blacklisted_squadrons().
|
||||
# Blacklisted users, squadrons, and guilds now live in the shared,
|
||||
# version-controlled BOTS/SHARED/BLACKLIST.json (read via shared_store) so both
|
||||
# bots share one source of truth. Use check_user_blacklist() /
|
||||
# shared_store.blacklisted_squadrons() / shared_store.blacklisted_guilds().
|
||||
|
||||
# ── Premium / Entitlements ────────────────────────────────────────────────────
|
||||
PREMIUM_ACTIVATION_TS: int = 1775459700 # Unix timestamp when premium gating activates
|
||||
@@ -527,9 +525,10 @@ async def is_dev_team(interaction: discord.Interaction) -> bool:
|
||||
def is_blacklisted():
|
||||
"""Return an app-command check that rejects blacklisted users or guilds.
|
||||
|
||||
Blacklisted users come from the shared BLACKLIST.json (see
|
||||
``shared_store.check_user_blacklist``); entries there may include an
|
||||
internal comment/name and an optional reason.
|
||||
Both blacklisted users and blacklisted guilds come from the shared
|
||||
BLACKLIST.json (see ``shared_store.check_user_blacklist`` and
|
||||
``shared_store.blacklisted_guilds``); entries there may include an internal
|
||||
comment/name and an optional reason.
|
||||
|
||||
Raises:
|
||||
BlacklistCheckFailure: If the guild or user is blacklisted,
|
||||
@@ -537,7 +536,7 @@ def is_blacklisted():
|
||||
"""
|
||||
async def predicate(interaction: discord.Interaction):
|
||||
guild = interaction.guild
|
||||
if guild is not None and guild.id in BLACKLISTED_SERVER_IDS:
|
||||
if guild is not None and guild.id in blacklisted_guilds():
|
||||
raise BlacklistCheckFailure(t("en", "common.access_denied_desc"))
|
||||
|
||||
blocked, reason = check_user_blacklist(interaction.user.id)
|
||||
|
||||
Reference in New Issue
Block a user