mirror of
https://github.com/midoks/mdserver-web.git
synced 2026-10-18 23:45:52 +08:00
up
This commit is contained in:
@@ -7,8 +7,9 @@ import json
|
|||||||
import base64
|
import base64
|
||||||
import threading
|
import threading
|
||||||
|
|
||||||
# import telebot
|
import telebot
|
||||||
from telebot import types
|
from telebot import types
|
||||||
|
from telebot.util import quick_markup
|
||||||
|
|
||||||
|
|
||||||
def isThisCmd(cmd, msg):
|
def isThisCmd(cmd, msg):
|
||||||
@@ -65,10 +66,16 @@ def searchDebugReply(bot, message, cmd_text):
|
|||||||
|
|
||||||
|
|
||||||
def searchDebugMsgInline(bot, message, cmd_text):
|
def searchDebugMsgInline(bot, message, cmd_text):
|
||||||
button = {"test1": {"callback_data": "test"},
|
button = {
|
||||||
"test2": {"url": "google.com"}}
|
"如何在安装面板?": {"callback_data": "bbs_id_1"},
|
||||||
bot.send_message(message.chat.id, "Test",
|
"如何在安装面板2?": {"callback_data": "bbs_id_2"},
|
||||||
reply_markup=quick_markup(button, row_width=2))
|
"下一页": {"callback_data": "bbs_pre"},
|
||||||
|
"上一页": {"url": "google.com"}
|
||||||
|
}
|
||||||
|
|
||||||
|
bot.reply_to(message, "Test",
|
||||||
|
reply_markup=quick_markup(button, row_width=2))
|
||||||
|
# bot.send_message(message.chat.id, "Test",reply_markup=quick_markup(button, row_width=2))
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
@@ -77,19 +84,27 @@ def searchDebug(bot, message, cmd_text):
|
|||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
|
def answer_callback_query(bot, call):
|
||||||
|
print(call)
|
||||||
|
bot.send_message(call.message.chat.id, "Test Callback")
|
||||||
|
# bot.answer_callback_query(call.id)
|
||||||
|
|
||||||
|
|
||||||
def run(bot, message):
|
def run(bot, message):
|
||||||
|
print(message)
|
||||||
text_body = message.text
|
text_body = message.text
|
||||||
if isThisCmd('/?:', text_body):
|
# print(text_body)
|
||||||
cmd_text = getReadCmd('/?:', text_body)
|
if isThisCmd('/faq:', text_body):
|
||||||
|
cmd_text = getReadCmd('/faq:', text_body)
|
||||||
return searchFaq(bot, message, cmd_text)
|
return searchFaq(bot, message, cmd_text)
|
||||||
|
|
||||||
if isThisCmd('/debug', text_body):
|
if isThisCmd('/debug', text_body):
|
||||||
cmd_text = getReadCmd('/debug', text_body)
|
cmd_text = getReadCmd('/debug', text_body)
|
||||||
return searchDebug(bot, message, cmd_text)
|
return searchDebug(bot, message, cmd_text)
|
||||||
|
|
||||||
if text_body.find('?') > -1:
|
if text_body.find('?') > -1 or text_body.find('?') > -1:
|
||||||
return_msg = "你似乎在寻找答案:\n"
|
return_msg = "你似乎在寻找【" + text_body + "】答案:\n"
|
||||||
return_msg += "/?:开始寻找你的问题\n"
|
return_msg += "/faq:开始寻找你的问题\n"
|
||||||
bot.reply_to(message, return_msg)
|
bot.reply_to(message, return_msg)
|
||||||
|
|
||||||
return bot
|
return bot
|
||||||
|
|||||||
@@ -122,6 +122,19 @@ def all_message(message):
|
|||||||
writeLog('-----all_message error end -------')
|
writeLog('-----all_message error end -------')
|
||||||
|
|
||||||
|
|
||||||
|
@bot.callback_query_handler(func=lambda call: True)
|
||||||
|
def callback_query_handler(call):
|
||||||
|
rlist = getStartExtCfgByTag('receive')
|
||||||
|
for r in rlist:
|
||||||
|
try:
|
||||||
|
script = r['name'].split('.')[0]
|
||||||
|
__import__(script).answer_callback_query(bot, call)
|
||||||
|
except Exception as e:
|
||||||
|
writeLog('-----callback_query_handler error start -------')
|
||||||
|
writeLog(mw.getTracebackInfo())
|
||||||
|
writeLog('-----callback_query_handler error end -------')
|
||||||
|
|
||||||
|
|
||||||
def runBotPushTask():
|
def runBotPushTask():
|
||||||
plist = getStartExtCfgByTag('push')
|
plist = getStartExtCfgByTag('push')
|
||||||
for p in plist:
|
for p in plist:
|
||||||
|
|||||||
Reference in New Issue
Block a user