def handle_text_msg(msg):
global IN_ACTION
# todo ?????? ???????
username = msg['ActualNickName'] # ???,??
content = msg['Text']
userlogo = msg["UserImg"]
# ??
if username in setting.ACTION_ADMIN and setting.ACTION_KEYWORD in content:
begin_action()
response = "????! 2?????:)"
return {'type': 'b', 'response': response} # ???? ??
if '[??]' in content and IN_ACTION:
# ?? ????
clean_content = re.split(r'\[??\]', content)[-1]
if clean_content:
# todo :???????? ???????
clean_content = "<span class='api_icon'></span><span class='api_nickname'>" + username + "</span>" + clean_content
try:
# ????? timeout
plugin.msg_input(msg=clean_content)
except Exception as e:
logger.error(str(e))
# ???????webhook
# ?? forum_client.post_thread(username,clean_content)
# ??username????????clean_content?????
response = "@{} ??????".format(username)
return {'type': 'q', 'response': response}
# if '/bot/t' in content:
'''
if content.startswith('[??]'):
#??
#?????????
thread_id,clean_content = re.split(r'\[??\].*?(?P<id>\d+)', content)[-2:]
response = "????:)"
return {'type':'t','response':response}
'''
# if '/bot/h' in content:
if '[??]' in content:
# help
#response='Hi @{} ???????\n??:[??]\n??:[??] ????\n??:[??](id) ????\n??:[??] ????'.format(msg['ActualNickName'])
response = 'Hi @{} ???????\n??:[??]\n??:[??] ????'.format(
msg['ActualNickName'])
return {'type': 'h', 'response': response}
return {'type': None, 'response': None} # ???
# ????
评论列表
文章目录