mirror of
https://github.com/midoks/mdserver-web.git
synced 2026-10-18 23:45:52 +08:00
up
This commit is contained in:
@@ -11,5 +11,5 @@ import base64
|
||||
import threading
|
||||
|
||||
|
||||
def run():
|
||||
def run(bot):
|
||||
print("!11")
|
||||
|
||||
@@ -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('/?:', '/?:如何在安装面板'))
|
||||
|
||||
@@ -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():
|
||||
|
||||
Reference in New Issue
Block a user