Skip to content

Latest commit

 

History

History
47 lines (39 loc) · 1.26 KB

README.md

File metadata and controls

47 lines (39 loc) · 1.26 KB

tgbot_codeforcewarrior

Installation

Create tgbot/config.json with the following format:

{
  "TOKEN": "",
  "SECRET": "",
  "CLIST_API_KEY": "",
  "FUNCTIONS_URL": "https://xxxxxxxxxxx.cloudfunctions.net",
  "CF_UPDATE_URL": "",
  "CHAT_ID": -100000000000
}
  • TOKEN: Telegram bot token
  • SECRET: Generate using python -c "import secrets; print(secrets.token_hex(10))"
  • CLIST_API_KEY: Create a clist.by account and obtain it here
  • FUNCTIONS_URL: URL of the functions deployed on GCP
  • CF_UPDATE_URL: URL of where cf_update is deployed
  • CHAT_ID: Telegram group ID

Set up webhook for Telegram bot.

Deployment

tgbot

gcloud app deploy

cf_verification

gcloud functions deploy cf_verification --trigger-http --allow-unauthenticated --region asia-northeast1 --memory 256MB --runtime python39

decline_join_request

gcloud functions deploy decline_join_request --trigger-http --allow-unauthenticated --region asia-northeast1 --memory 256MB --runtime python39

cf_update

Deploy on any *nix web server. (gunicorn does not work on Windows)

pip install -r requirements.txt
gunicorn tgbot.cf_update:create_app --bind localhost:4000 --worker-class aiohttp.GunicornWebWorker