修改配置文件Key拼写错误 删除多余配置

This commit is contained in:
洛水.山岭居室 2022-05-28 15:55:33 +08:00
parent 95a9a4dd34
commit 9c2db7fa94
3 changed files with 4 additions and 12 deletions

View File

@ -14,19 +14,15 @@
"telegram": { "telegram": {
"token": "", "token": "",
"notice": { "notice": {
"INFO": {
"name": "",
"char_id":
},
"ERROR": { "ERROR": {
"name": "", "name": "",
"char_id": "chat_id":
} }
}, },
"channel": { "channel": {
"POST": { "POST": {
"name": "", "name": "",
"char_id": "chat_id":
} }
} }
}, },

View File

@ -11,14 +11,10 @@ from logger import Log
from config import config from config import config
try: try:
notice_chat_id = config.TELEGRAM["notice"]["ERROR"]["char_id"] notice_chat_id = config.TELEGRAM["notice"]["ERROR"]["chat_id"]
admin_list = []
for admin in config.ADMINISTRATORS:
admin_list.append(admin["user_id"])
except KeyError as error: except KeyError as error:
Log.warning("错误通知Chat_id获取失败或未配置BOT发生致命错误时不会收到通知 错误信息为\n", error) Log.warning("错误通知Chat_id获取失败或未配置BOT发生致命错误时不会收到通知 错误信息为\n", error)
notice_chat_id = None notice_chat_id = None
admin_list = []
async def error_handler(update: object, context: CallbackContext) -> None: async def error_handler(update: object, context: CallbackContext) -> None:

View File

@ -100,7 +100,7 @@ class Post(BasePlugins):
await message.reply_text("正在推送", reply_markup=ReplyKeyboardRemove()) await message.reply_text("正在推送", reply_markup=ReplyKeyboardRemove())
try: try:
channel_name = config.TELEGRAM["channel"]["POST"]["name"] channel_name = config.TELEGRAM["channel"]["POST"]["name"]
channel_id = config.TELEGRAM["channel"]["POST"]["char_id"] channel_id = config.TELEGRAM["channel"]["POST"]["chat_id"]
except KeyError as error: except KeyError as error:
Log.error("从配置文件获取频道信息发生错误,退出任务 \n", error) Log.error("从配置文件获取频道信息发生错误,退出任务 \n", error)
await message.reply_text("从配置文件获取频道信息发生错误,退出任务", reply_markup=ReplyKeyboardRemove()) await message.reply_text("从配置文件获取频道信息发生错误,退出任务", reply_markup=ReplyKeyboardRemove())