mirror of
https://github.com/TeamPGM/PagerMaid-Pyro.git
synced 2024-11-28 05:33:54 +00:00
parent
782d9fce51
commit
efea7afd01
@ -26,6 +26,7 @@ web_interface:
|
||||
application_language: "zh-cn"
|
||||
application_region: "China"
|
||||
application_tts: "zh-CN"
|
||||
timezone: "Asia/ShangHai"
|
||||
|
||||
# In-Chat logging settings, default settings logs directly into Kat, strongly advised to change
|
||||
log: "False"
|
||||
|
@ -1,8 +1,10 @@
|
||||
import os
|
||||
from json import load as load_json
|
||||
import sys
|
||||
from yaml import load, FullLoader, safe_load
|
||||
from json import load as load_json
|
||||
from shutil import copyfile
|
||||
from typing import Dict
|
||||
|
||||
from yaml import load, FullLoader, safe_load
|
||||
|
||||
|
||||
def strtobool(val, default=False):
|
||||
@ -23,7 +25,7 @@ def strtobool(val, default=False):
|
||||
|
||||
|
||||
try:
|
||||
config = load(open(r"config.yml", encoding="utf-8"), Loader=FullLoader)
|
||||
config: Dict = load(open(r"config.yml", encoding="utf-8"), Loader=FullLoader)
|
||||
except FileNotFoundError:
|
||||
print("The configuration file does not exist, and a new configuration file is being generated.")
|
||||
copyfile(f"{os.getcwd()}{os.sep}config.gen.yml", "config.yml")
|
||||
@ -46,6 +48,7 @@ class Config:
|
||||
ERROR_REPORT = strtobool(os.environ.get("PGM_ERROR_REPORT", config["error_report"]), True)
|
||||
LANGUAGE = os.environ.get("PGM_LANGUAGE", config["application_language"])
|
||||
REGION = os.environ.get("PGM_REGION", config["application_region"])
|
||||
TIME_ZONE = os.environ.get("PGM_TIME_ZONE", config.get("timezone", "Asia/Shanghai"))
|
||||
TTS = os.environ.get("PGM_TTS", config["application_tts"])
|
||||
LOG = strtobool(os.environ.get("PGM_LOG", config["log"]))
|
||||
LOG_ID = int(os.environ.get("PGM_LOG_ID", config["log_chatid"]))
|
||||
|
@ -3,9 +3,11 @@ import datetime
|
||||
|
||||
import pytz
|
||||
from apscheduler.schedulers.asyncio import AsyncIOScheduler
|
||||
|
||||
from pagermaid.config import Config
|
||||
from pagermaid.single_utils import Message
|
||||
|
||||
scheduler = AsyncIOScheduler(timezone="Asia/ShangHai")
|
||||
scheduler = AsyncIOScheduler(timezone=Config.TIME_ZONE)
|
||||
|
||||
|
||||
async def delete_message(message: Message) -> bool:
|
||||
@ -21,5 +23,5 @@ def add_delete_message_job(message: Message, delete_seconds: int = 60):
|
||||
id=f"{message.chat.id}|{message.id}|delete_message",
|
||||
name=f"{message.chat.id}|{message.id}|delete_message",
|
||||
args=[message],
|
||||
run_date=datetime.datetime.now(pytz.timezone("Asia/Shanghai")) + datetime.timedelta(seconds=delete_seconds),
|
||||
run_date=datetime.datetime.now(pytz.timezone(Config.TIME_ZONE)) + datetime.timedelta(seconds=delete_seconds),
|
||||
replace_existing=True)
|
||||
|
Loading…
Reference in New Issue
Block a user