Skip to content

🤖 LINE CHATBOT( with QR code, a simple demo, keep updating )

License

Notifications You must be signed in to change notification settings

iitsmel/AlgorithmBot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Algorithm Bot

Purpose, Triger Words and Demos

A chatbot uses LIFF to show some explanations and demonstrations about algorithms based on my blog.
Aiming to help people to learn algorithms by providing my point of view.

  • sorting

sorting-demo

  • tree

tree-demo

  • hash

hash-demo


Platform & QR Code

front-end : LINE API, LINE Login(LIFF), Rich Menu, Flex Message
back-end : Heroku
All the information about data structures come from here.


Problems I've encountered & currently solved

  • unable to successfully verify Webhook URL
    enter following commands works for me

git add .
git commit -am "your previous input"


"your previous input" is what you entered the very first time.

git push heroku main
heroku logs --tail


"heroku logs --tail" will show all logs in terminal.

This step is not necessery but very handy and convinent when you don't want to switch to Heroku Application log page.


  • a little bit confused about flex message
    Here's my conclution about flex message:

line_bot_api.reply_message(
    event.reply_token,
    FlexSendMessage(alt_text= 'hi', 
            contents = { 'type': 'bubble', 'direction': 'ltr',
                'hero': {
                    'type': 'image',
                    'url': 'https://example.com/cafe.jpg',
                    'size': 'full',
                    'aspectRatio': '20:13',
                    'aspectMode': 'cover',
                    'action': { 'type': 'uri', 'uri': 'http://example.com', 'label': 'label' }
                }
            }
    )
)

Make sure to put "from linebot.models import FlexSendMessage" in code.
"line_bot_api.reply_message" will give you the leverage to be able to send a message through bot.
" event.reply_token" means that the bot will reply to this specific token.
Finally, here's the flex message part.
"alt_text" is a must because whatever you type in or put behind will represent the user's reply(to the bot).
By recognizing this reply, the bot will send a flex message.
In other words, "alt_text" is sort of a trigger word.
"contents" is what your flex message should look like.
So there you go, can't make a flex message out of empty alt_text and contents.


  • json problem

This website helped me a lot. Remember, json has a specific form, there are some content can't be deleted.

Language

Python

Colors Section

thoughts : Panton COLOR OF THE YEAR 2021, FRIENDS

  • PANTONE 17-5104 Ultimate Gray #939597
  • PANTONE 13-0647 Illuminating #F5DF4D

  • background : #FFF580
  • shade : #00009E
  • word : #42A2D6

  • background : #9C8CD4
  • shade : #665236
  • word : #D2C385

  • background : #FFDC00
  • shade : #9A0006
  • word : #FF4238

About

🤖 LINE CHATBOT( with QR code, a simple demo, keep updating )

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages