我正在做一个关于移动学习的项目。我正在制作一个电报机器人,它首先向用户发送视频,如果他准备好了,然后发送测验。机器人不等待就绪条件并一次性发送所有消息。我正在使用 mysql 数据库来获取视频和测验。
我在句柄(msg)中有问题的代码是:
command=msg["text"].strip().lower()
bot.sendMessage(chat_id,"Say hi to see your options")
if content_type=='text' and chat_id in list1 and command=="hi":
video_link=get_fast_video_link(chat_id)
bot.sendVideo(chat_id,video=open(str(video_link),'rb'));print("video sent")
video_id=get_fast_video_id(chat_id)
list4=start_quiz(video_id)
id_q=list4[0]
question=list4[1]
answer=list4[2]
bot.sendMessage(chat_id,"Are you ready")
if command== "ready":
bot.sendMessage(chat_id,"Here is your question")
bot.sendMessage(chat_id,str(question))
if command==str(answer):
bot.sendMessage(chat_id,"You Are CORRECT")
bot.sendMessage(chat_id,"Let's move to the next video")
机器人无需等待用户的回复,而是一次性发送所有消息。我是制作机器人的新手,并且有基础知识,我该如何制作这个项目