Skip to content

wolffparkinson/PLeagueBot

 
 

Repository files navigation

P+ League LINE Chatbot

License: MIT Python Version

加入好友

Prerequisite

  • flask/Python 3.8
  • LINE v10.14
  • PostgreSQL

You need Github, LINE, Heroku accounts to deploy this bot.

Developer Side

Environment property

Fill in the following environment variables:

LINE_CHANNEL_ACCESS_TOKEN=
LINE_CHANNEL_SECRET=
DATABASE_URL=postgres://USER:PASSWORD@127.0.0.1:5432/postgres

You need to modify DATABASE_URL as your postgresql settings.

LINE account (LINE_CHANNEL_ACCESS_TOKEN, LINE_CHANNEL_SECRET)

  • Got A LINE Bot API developer account Make sure you already registered, if you need use LINE Bot.
  • Go to LINE Developer Console
    • Close auto-reply setting on "Messaging API" Tab.
    • Setup your basic account information. Here is some info you will need to know.
      • Callback URL: https://{YOUR_URL}/webhooks/line
      • Verify your webhook.
  • You will get following info, need fill back to .env file.
    • Channel Secret
    • Channel Access Token (You need to issue one here)

Local testing

  1. Run Scripts/ profiles first, sync official website data to database as crawler.

  2. first terminal window

cp .env.example .env # Modify variables value

# By docker (choose one)
docker-compose up # and go to DOCKER_IP:4040

# By localized (choose one)
pip install -r requirements.txt --user
python api.py
  1. Create a provisional Https:
ngrok http 5000

or maybe you have npm environment:

npx ngrok http 5000

  1. Copy URL to LINE Developer Console

Heroku

Deploy

  • Enable clock button to schedule corn.

  • Add Heroku Postgres and it would create DATABASE_URL environment variable automatically.

If you are not sure where are files in, use following up commands:

heroku run bash
heroku logs --tail

License

MIT License

About

P+ League Chatbot(unofficial)

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Python 95.1%
  • HTML 2.8%
  • Dockerfile 1.9%
  • Shell 0.2%