livz / LizBot

Telegram bot on Google App Engine

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

LizBot

Deployment of LanaBot Telegram bot on Google App Engine using web hooks:

Steps to add your Telegram bot to Google App Engine

  1. Create a new code repository on Cloud Platform:

Google Cloud Platform -> Development -> Source code

  1. Connect a local repository:
$ gcloud init
$ git config credential.helper gcloud.sh    
$ git remote add google https://source.developers.google.com/p/fuzzylizbot/r/lizbot
  1. Push changes from local repository to Google Cloud:
$ git add file1 file2
$ git commit -m "commit message"
$ git push --all google
  1. Deploy the app:
$ gcloud app deploy app.yaml --project <project name> -v <version_id> --verbosity=info
  1. Open app in the browser to test:
$ gcloud app browse

Configuration

The configuration file config.ini.example needs to be renamed and modified:

[Settings]

; Telegram API token, from @Botfather
TOKEN = 74632864382432:AxxxYBFA99Hixo_jTsfsd08J

;Token for webhook  URL
HOOK_TOKEN = ab10e773c1fadca323af2a561eedcbb8

; Google App Engine project id
PROJECT_ID = fuzzylizbot

; Open Weather Map API Key
OWM_KEY = daa3171a18d73c8c1c6c5f13c1298331

Management and debugging

  • Read requests logs from default application:
$ gcloud app logs read --service default --limit 10
  • Stream requests logs from the command line:
$  gcloud app logs tail -s default
  • Application logs (including logs from Python's logging module) are generated per request, and can be viewed in the console:
    • Google Cloud Platform -> Stackdriver logging -> Logs

Logs

  • You can also read the applications logs via API

  • Manage application versions from the console:

    • List all versions:
$ gloud app versions list
  • Delete vesions:
$ gcloud app versions delete v1 v2
  • Manage versions using GUI :
    • Google Cloud Platform -> App Engine -> Versions

Versions

References

Google App Engine dashboard

Adding Cloud Source Repositories as Remote

Telegram Bot API

About

Telegram bot on Google App Engine


Languages

Language:Python 100.0%