add leave option and wire up (#1264)
This commit is contained in:
+18
-7
@@ -1144,19 +1144,30 @@ async def execute_leave_alarm_task():
|
||||
continue
|
||||
if str(pref_key).lower() in WILDCARD_KEYS or str(pref_key).lower() == "global":
|
||||
continue
|
||||
raw_chan = squad_prefs.get("Leave") or squad_prefs.get("Points")
|
||||
if not raw_chan:
|
||||
leave_chan = squad_prefs.get("Leave")
|
||||
points_chan = squad_prefs.get("Points")
|
||||
if not leave_chan and not points_chan:
|
||||
continue
|
||||
# Respect the Points tier cap — identical gate used by execute_points_alarm_task.
|
||||
if tier_enforcement_active() and pref_key not in allowed_points:
|
||||
continue
|
||||
try:
|
||||
channel_id = int(raw_chan.strip("<#>"))
|
||||
except Exception:
|
||||
continue
|
||||
resolved = await resolve_pref_key(pref_key, squad_prefs)
|
||||
target_name = resolved["long_name"] if resolved and resolved.get("long_name") else pref_key
|
||||
squadron_channels.setdefault(target_name, []).append((guild_id, channel_id))
|
||||
|
||||
# Check Leave first, then fallback to Points. If both are present,
|
||||
# send to both routes (helps staged migrations to the new pref key).
|
||||
raw_channels = [leave_chan, points_chan]
|
||||
for raw_chan in raw_channels:
|
||||
if not raw_chan:
|
||||
continue
|
||||
try:
|
||||
channel_id = int(raw_chan.strip("<#>"))
|
||||
except Exception:
|
||||
continue
|
||||
targets = squadron_channels.setdefault(target_name, [])
|
||||
target = (guild_id, channel_id)
|
||||
if target not in targets:
|
||||
targets.append(target)
|
||||
|
||||
if not squadron_channels:
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user