agus1111 commited on
Commit
1206467
·
verified ·
1 Parent(s): f6029ef

Update botsignal.py

Browse files
Files changed (1) hide show
  1. botsignal.py +13 -3
botsignal.py CHANGED
@@ -85,7 +85,7 @@ EXCLUDE_PHRASES = [p.strip().lower() for p in os.environ.get(
85
  # ====== Milestones label (untuk copy di pesan awal CA) ======
86
  _M_RAW = os.environ.get("MILESTONES", "1.5,2")
87
  try:
88
- _M_LIST = [x.strip() for x in _M_RAW.split(",") if x.strip()] # fixed: _RAW -> _M_RAW
89
  except Exception:
90
  _M_LIST = ["1.5", "2"]
91
  try:
@@ -155,7 +155,7 @@ SUPPORT_CHATS = [
155
  "https://t.me/AnimeGems",
156
  "https://t.me/veigarcalls",
157
  "https://t.me/primegems",
158
- "https://t.me/Superapedegenlife",
159
  "https://t.me/dr_crypto_channel",
160
  "https://t.me/savascalls",
161
  "https://t.me/Tanjirocall",
@@ -274,7 +274,14 @@ def db_summary_log_call(keyword: str, msg_id: int, tier: str, ts_utc: int):
274
 
275
  _init_db()
276
  db_summary_init()
277
- last_posted, keyword_group_last_seen = db_load_state()
 
 
 
 
 
 
 
278
 
279
  # =========================
280
  # Utils
@@ -1031,6 +1038,8 @@ async def periodic_lb_trigger():
1031
  # =========================
1032
  async def main():
1033
  await client.start()
 
 
1034
  # (opsional) mulai scheduler leaderboard
1035
  try:
1036
  asyncio.create_task(periodic_lb_trigger())
@@ -1096,6 +1105,7 @@ async def start_bot_background():
1096
  return
1097
 
1098
  await client.start()
 
1099
 
1100
  try:
1101
  _BG_TASKS.append(asyncio.create_task(periodic_lb_trigger()))
 
85
  # ====== Milestones label (untuk copy di pesan awal CA) ======
86
  _M_RAW = os.environ.get("MILESTONES", "1.5,2")
87
  try:
88
+ _M_LIST = [x.strip() for x in _M_RAW.split(",") if x.strip()]
89
  except Exception:
90
  _M_LIST = ["1.5", "2"]
91
  try:
 
155
  "https://t.me/AnimeGems",
156
  "https://t.me/veigarcalls",
157
  "https://t.me/primegems",
158
+ "https://t.me/Superapedegenlife",
159
  "https://t.me/dr_crypto_channel",
160
  "https://t.me/savascalls",
161
  "https://t.me/Tanjirocall",
 
274
 
275
  _init_db()
276
  db_summary_init()
277
+
278
+ # >>> DEFERRED INIT STATE (hindari NameError saat import oleh server.py)
279
+ last_posted = {}
280
+ keyword_group_last_seen = {}
281
+
282
+ def _late_init_state():
283
+ global last_posted, keyword_group_last_seen
284
+ last_posted, keyword_group_last_seen = db_load_state()
285
 
286
  # =========================
287
  # Utils
 
1038
  # =========================
1039
  async def main():
1040
  await client.start()
1041
+ _late_init_state() # <<< load DB state setelah fungsi2 terdefinisi & client start
1042
+
1043
  # (opsional) mulai scheduler leaderboard
1044
  try:
1045
  asyncio.create_task(periodic_lb_trigger())
 
1105
  return
1106
 
1107
  await client.start()
1108
+ _late_init_state() # <<< pastikan state ke-load saat server start background
1109
 
1110
  try:
1111
  _BG_TASKS.append(asyncio.create_task(periodic_lb_trigger()))