例如,机器人发送“给我你的名字”,“给我你的姓氏”并将这些数据保存在两个变量中。我的语言是 python,我使用 Telepot 包来制作机器人
Check out this link. Scroll down for examples. Hope this helps!
In telepot package:
import telepot
from telepot.loop import MessageLoop
import time
bot = telepot.Bot('my_token')
def handle(msg):
content_type, chat_type, chat_id = telepot.glance(msg)
send1 = bot.sendMessage(chat_id,'whats your name?')
if send1:
text1 = msg['text']
print(text1)
MessageLoop(bot,handle).run_as_thread()
while 1:
time.sleep(1)
text1 variable is the reply associate to question "whats your name?"
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.