This commit is contained in:
midoks
2023-03-14 01:10:04 +08:00
parent 39d265aae7
commit 936492d410
3 changed files with 38 additions and 11 deletions
+1 -1
View File
@@ -11,5 +11,5 @@ import base64
import threading
def run():
def run(bot):
print("!11")
+31 -1
View File
@@ -7,8 +7,38 @@ import json
import base64
import threading
import telebot
# import telebot
cmd_list = [
'/?:',
]
def isThisCmd(cmd, msg):
clen = len(cmd)
msg_len = len(msg)
if msg_len < clen:
return False
check_msg = msg[0:clen]
if cmd == check_msg:
return True
return False
def searchFaq(bot, message):
# print(search_text)
bot.reply_to(message, message.chat.id)
return True
def run(bot, message):
text_body = message.text
for cmd in cmd_list:
if isThisCmd(cmd, text_body):
return searchFaq(bot, message)
return bot
if __name__ == "__main__":
print(isThisCmd('/?:', '/?:如何在安装面板'))
+6 -9
View File
@@ -85,14 +85,7 @@ while True:
bot = telebot.TeleBot(cfg['bot']['app_token'])
# from telebot.async_telebot import AsyncTeleBot
# import asyncio
# bot = AsyncTeleBot(cfg['bot']['app_token'])
# use in for delete with the necessary scope and language_code if necessary
bot.delete_my_commands(scope=None, language_code=None)
bot.set_my_commands(
commands=[
telebot.types.BotCommand("start", "查看帮助信息"),
@@ -123,7 +116,9 @@ def all_message(message):
script = r['name'].split('.')[0]
__import__(script).run(bot, message)
except Exception as e:
pass
writeLog('-----all_message error start -------')
writeLog(mw.getTracebackInfo())
writeLog('-----all_message error end -------')
def runBotPushTask():
@@ -133,7 +128,9 @@ def runBotPushTask():
script = p['name'].split('.')[0]
__import__(script).run(bot)
except Exception as e:
pass
writeLog('-----runBotPushTask error start -------')
writeLog(mw.getTracebackInfo())
writeLog('-----runBotPushTask error end -------')
def botPush():