6.6.0 • Published 23 hours ago

@codebam/cf-workers-telegram-bot v6.6.0

Weekly downloads
-
License
Apache-2.0
Repository
github
Last release
23 hours ago

cf-workers-telegram-bot

Deploy to Cloudflare Workers

screenshot of cf-workers-telegram-bot

serverless telegram bot on cf workers

The original worker.js is the content of Nikhil John's https://github.com/nikhiljohn10/telegram-bot-worker which is licensed with MIT. My modifications are licensed under the Apache license.

The first bot configuration is fully featured, and responds to all received messages with llama2 if a command isn't found.

To get continuous conversation with llama2 working make sure you add a database to your wrangler.toml and initailize it with the schema.sql

To use the deploy button:

  • Click the deploy button
  • Navigate to your new GitHub repository > Settings > Secrets and add the following secrets:

    - Name: CLOUDFLARE_API_TOKEN  (should be added automatically)
    - Name: CLOUDFLARE_ACCOUNT_ID (should be added automatically)
    
    - Name: SECRET_TELEGRAM_API_TOKEN
    - Value: your-telegram-bot-token
  • Push to master to trigger a deploy

To fork this repo and use wrangler:

  • Click fork
  • npm i -g wrangler
  • wrangler secret put SECRET_TELEGRAM_API_TOKEN and set it to your telegram bot token
  • wrangler d1 create llama2
  • put the database block from the command in your wrangler.toml
  • wrangler d1 execute --remote llama2 --file ./schema.sql
  • wrangler deploy
  • Done!

Getting started with cf-workers-telegram-bot

Once you've deployed the bot you can get your Webhook command URL by doing any of the following.

  • sha256sum(SECRET_TELEGRAM_API_TOKEN) is the path to your webhook commands and should be put at the end of your worker URL to access commands such as setting your webhook
  • Use echo -n yoursecretkey | sha256sum to get the path
  • Open the Cloudflare Worker Logs under Workers > cf-workers-telegram-bot > Logs > Begin log stream and make a GET request (open it in your browser) to your Worker URL and look at the logs to see your Access URL
  • Run wrangler tail --format pretty from inside your git repository and make a GET request to your Worker URL

Example URL for setting the Webhook and dropping pending updates:

https://cf-workers-telegram-bot.codebam.workers.dev/a948904f2f0f479b8f8197694b30184b0d2ed1c1cd2a1ec0fb85d299a192a447?command=set

6.5.0

24 hours ago

6.6.0

23 hours ago

6.4.0

1 day ago

6.1.0

6 days ago

6.2.0

6 days ago

5.17.0

8 days ago

5.16.0

9 days ago

5.15.0

2 months ago

5.14.0

6 months ago

5.4.0

9 months ago

5.2.0

9 months ago

5.1.0

10 months ago

5.0.0

10 months ago

5.13.0

7 months ago

5.12.0

7 months ago

5.10.0

7 months ago

4.11.0

10 months ago

5.9.0

7 months ago

5.8.0

8 months ago

5.7.0

9 months ago

4.10.0

11 months ago

4.9.0

11 months ago

4.8.0

11 months ago

4.7.0

12 months ago

4.5.0

1 year ago

4.4.0

1 year ago

4.3.0

1 year ago

4.1.0

1 year ago

4.2.0

1 year ago

4.0.0

1 year ago

3.48.0

1 year ago

3.47.0

1 year ago

3.46.0

1 year ago

3.45.0

1 year ago

3.44.0

1 year ago

3.42.0

1 year ago

3.41.0

1 year ago

3.40.0

1 year ago