/telegram-channel-bot-cloudflare

Telegram bot on Cloudflare, publish messages in Telegram channels.

Primary LanguageTypeScript

telegram-channel-bot-cloudflare

Telegram bot on Cloudflare, publish messages in Telegram channels.

Workers

Cloudflare workers prefix: tcb-.

tcb-flickr-oauth

Provide OAuth 1a service for Flickr APIs.

Route: ${DOMAIN_NAME}/flickr/oauth.

tcb-flickr-polling

Polling Flickr's API to get latest photos, generate messages, then send them to Telegram channel.

It will store the hash of generated message to database, and edit existing message if hash changes.

KV

Default KV name: tcb.

To setup KV, you need to provide following keys:

  • flickr.consumer.key: Flicker app's key
  • flickr.consumer.secret: Flicker app's secret
  • telegram.bot_token: Telegram bot's token
  • telegram.error_reporting_chat_id: The Telegram chat to report worker errors
  • telegram.photo_channel_id: The Telegram channel to send photo information messages

The following keys will be generated by workers automatically:

  • flickr.oauth.token
  • flickr.oauth.token_secret
  • flickr.oauth.verifier
  • worker.polling.running_status_id

D1

Default D1 database name: tcb.

There is no need to prepare D1 databases. Worker will create databases on the first run.

Durable Objects

It's also unnecessary to prepare for DO.

An DO will be generated at the first time run, and the object ID will be stored in KV: worker.polling.running_status_id.

Reset Durable Objects

Deployment during working running may cause DO working unproperly. Usually, DO may not be reset to idle status correctly, or the ID of DO becomes incorrect.

To fix DO issues, remove worker.polling.running_status_id from KV. Worker will generate a new DO instead.