我正在使用python创建一个电报机器人,并使用python-电- bot库发送响应,但是如何使用这个库从输入中获取输入呢?
祝程序员度过美好的一天
发布于 2022-03-28 07:48:25
使用python-电报-bot v12.0.0b1,您可以这样做:
def do_something(user_input):
answer = "You have wrote me " + user_input
return answer
def reply(update, context):
user_input = update.message.text
update.message.reply_text(do_something(user_input))
def main():
updater = Updater("TOKEN", use_context=True)
dp = updater.dispatcher
dp.add_handler(MessageHandler(Filters.text, reply))
updater.start_polling()
updater.idle()https://stackoverflow.com/questions/71643910
复制相似问题