Skip to content

jonowo/tgbot_codeforcewarrior

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

88 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 98.7%
  • Batchfile 1.3%