tgbot init命令分离

page-html
midoks 2 years ago
parent 03f8578a37
commit 956f20d295
  1. 27
      plugins/tgbot/startup/extend/init_cmd.py
  2. 17
      plugins/tgbot/startup/tgbot.py

@ -0,0 +1,27 @@
# coding:utf-8
import sys
import io
import os
import time
import re
import json
import base64
import threading
sys.path.append(os.getcwd() + "/class/core")
import mw
import telebot
from telebot import types
from telebot.util import quick_markup
def init(bot):
bot.delete_my_commands(scope=None, language_code=None)
bot.set_my_commands(
commands=[
telebot.types.BotCommand("start", "查看帮助信息"),
telebot.types.BotCommand("faq", "查看bbs帖子主题【不要忘记:冒号】"),
],
)

@ -86,14 +86,15 @@ while True:
bot = telebot.TeleBot(cfg['bot']['app_token'])
bot.delete_my_commands(scope=None, language_code=None)
bot.set_my_commands(
commands=[
telebot.types.BotCommand("start", "查看帮助信息"),
telebot.types.BotCommand("faq", "查看bbs帖子主题【不要忘记:冒号】"),
],
)
init_list = getStartExtCfgByTag('init')
for p in init_list:
try:
script = p['name'].split('.')[0]
__import__(script).init(bot)
except Exception as e:
writeLog('-----init error start -------')
writeLog(mw.getTracebackInfo())
writeLog('-----init error end -------')
# @bot.message_handler(commands=['start', 'help'])
# def hanle_start_help(message):

Loading…
Cancel
Save