作者shevchenlun ()
看板Python
标题[问题] linebot的变数与判断
时间Sun May 5 15:46:12 2019
x='111'
@handler.add(MessageEvent, message=TextMessage)
def handle_message(event):
if x == '111':
reply_text = 'hello'
x = '222' <-------只要不加这个执行都正常 就回复hello
esif x == '222':
reply_text = 'hihi'
message = TextSendMessage(reply_text)
line_bot_api.reply_message(event.reply_token, message)
请问想让bot在说过某些话 or 使用者作过某些事之後
bot说出不一样的话 而使用类似上面变数的写法 就执行不了
是handle_message()里面无法再变更变数吗??
还是我哪里搞错了??
请板上的各位大大 可以指导一下吗 感谢^^
--
※ 发信站: 批踢踢实业坊(ptt.cc), 来自: 36.234.71.217
※ 文章网址: https://webptt.com/cn.aspx?n=bbs/Python/M.1557042374.A.75F.html
1F:→ shevchenlun: 搞定了 原来忘记+global XDDD 05/05 17:58