File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1- version : " 3.1"
2-
31services :
42 app :
53 image : ghcr.io/102ch/thuuwa-tuuchi-bot:latest
Original file line number Diff line number Diff line change 1- version : " 3.1"
2-
31services :
42 app :
53 build : .
Original file line number Diff line number Diff line change 1- import os
2- from db_utils import (
3- load_notitext ,
4- load_is_target_channels ,
5- load_channel_id ,
6- load_call_end_notification_enabled ,
7- )
8-
9- INITIAL_CHANNEL = int (os .environ ['DISCORD_CHANNEL_ID' ])
10- INITIAL_TEXT = "@everyone"
11- INITIAL_FLAG = True
12-
1+ # 通話開始時刻を記録するための辞書(チャンネルID -> 開始時刻)
2+ # これはメモリ上でのみ管理(再起動時にリセットされる)
133e_time = {}
14- try :
15- notitext = load_notitext () # データベースから読み込み
16- print (f"[DB] notitext loaded: { notitext } " )
17-
18- is_target_channel = load_is_target_channels () # データベースから読み込み
19- print (f"[DB] is_target_channel loaded: { len (is_target_channel )} channels" )
20-
21- # channel_idをデータベースから読み込み、なければ初期値を使用
22- loaded_channel_id = load_channel_id ()
23- channel_id = loaded_channel_id if loaded_channel_id is not None else INITIAL_CHANNEL
24- print (f"[DB] channel_id loaded: { channel_id } (from DB: { loaded_channel_id is not None } )" )
25-
26- # is_call_end_notification_enabledをデータベースから読み込み、なければ初期値を使用
27- loaded_end_notification = load_call_end_notification_enabled ()
28- is_call_end_notification_enabled = loaded_end_notification if loaded_end_notification is not None else INITIAL_FLAG
29- print (f"[DB] is_call_end_notification_enabled loaded: { is_call_end_notification_enabled } (from DB: { loaded_end_notification is not None } )" )
30- except Exception as e :
31- print (f"[DB] ERROR: Failed to load from database: { e } " )
32- notitext = INITIAL_TEXT
33- is_target_channel = {}
34- channel_id = INITIAL_CHANNEL
35- is_call_end_notification_enabled = INITIAL_FLAG
You can’t perform that action at this time.
0 commit comments