This commit is contained in:
机器人总动员 2021-05-05 16:27:21 +08:00
parent 498463b00e
commit 68a614e2c5
2 changed files with 6 additions and 3 deletions

View File

@ -20,6 +20,8 @@ def chat_content_exec(update, context):
r = connector.get_connection() r = connector.get_connection()
text = update.message.text text = update.message.text
chat_type = update.effective_chat.type chat_type = update.effective_chat.type
if chat_type != "supergroup":
return
user_id = update.effective_user.id user_id = update.effective_user.id
chat_id = update.effective_message.chat_id chat_id = update.effective_message.chat_id
try: try:
@ -27,12 +29,13 @@ def chat_content_exec(update, context):
except Exception as e: except Exception as e:
username = update.effective_user.id username = update.effective_user.id
print("\n---------------------------") print("\n---------------------------")
print("内容: " + text) print("内容: " + text[:10])
print("群组类型: " + str(chat_type)) print("群组类型: " + str(chat_type))
print("用户ID: " + str(user_id)) print("用户ID: " + str(user_id))
print("chat_id: " + str(chat_id)) print("chat_id: " + str(chat_id))
if "/" in text: if "/" in text:
print("这是一条指令信息,跳过") print("这是一条指令信息,跳过")
return
else: else:
if text[-1] not in ["", "", "", "", "", "!", "?", ",", ":", "."]: if text[-1] not in ["", "", "", "", "", "!", "?", ",", ":", "."]:
r.append("{}_chat_content".format(chat_id), text + "") r.append("{}_chat_content".format(chat_id), text + "")

View File

@ -5,8 +5,8 @@ import schedule
from task import do_task from task import do_task
import threading import threading
# schedule.every().day.at('16:20').do(task).tag('task') schedule.every().day.at('16:20').do(do_task).tag('task')
schedule.every(1).minutes.do(do_task).tag('task') # schedule.every(1).minutes.do(do_task).tag('task')
threading.Thread(target=check_schedule).start() threading.Thread(target=check_schedule).start()