For the time being, write it as a memo for yourself.
First, I will explain in detail what I stumbled upon.
The sample code of LINE BOT is mostly the sample code of Echolalia.
To be honest, I'm not interested in returning parrots, so I struggled to find it.
If the text sent contains the string "apple", send it back as "apple".
test
if "Apple" in event.message.text:
I found the sample code.
I modified this a little
If the character string of the sent text matches "apple", send it back as "apple".
test
if event.message.text == "Apple":
I wanted to make the code, but I stumbled here.
How did you stumble?
test
if event.message.text == "Apple":
When I changed the code to, for some reason nothing came back.
The cause is
comp
if event.message.text == "/url":
line_bot_api.reply_message(
event.reply_token,
[TextSendMessage(text="Ah ah"))]
Can you see that there is a "[" in this code?
This was bad ...
So, when I erased the "[" and tried again, it worked.
Do not put [] in the code.
https://ux.getuploader.com/rdup/download/25
Recommended Posts