Skip to content

codebam/cf-workers-telegram-bot

 
 

Repository files navigation


CF Workers Telegram Bot

GitHub stars GitHub issues GitHub forks

screenshot of cf-workers-telegram-bot

A monorepo containing a Telegram Bot and a Svelte web application, both running on Cloudflare Workers and Pages.

Structure

This is a monorepo containing:

  • bot: The main Telegram Bot built with grammY
  • webapp: A Svelte 5 web application for interacting with the bot

Deployment

Deploying the Bot

  1. Clone the repository with submodules:

    git clone --recursive https://github.com/codebam/cf-workers-telegram-bot.git
  2. Install dependencies:

    npm install
  3. Configure the bot: Navigate to the bot directory and update wrangler.toml with your desired worker name and bindings.

  4. Set your Telegram Token: Get a token from @BotFather and add it to your worker:

    cd bot
    npx wrangler secret put SECRET_TELEGRAM_API_TOKEN
  5. Deploy:

    npm run deploy

For more information on deploying grammY bots, see the grammY deployment documentation.

Deploying the Web App

The web app is a SvelteKit project designed to be deployed to Cloudflare Pages.

cd webapp
npm install
npm run build
npx wrangler pages deploy .svelte-kit/cloudflare

Development

You can use the root Makefile to run common tasks across all projects:

make build   # Build all projects
make clean   # Clean build artifacts

Setup

  1. Install dependencies:

    npm install
  2. Set up Git hooks: This project uses custom Git hooks for quality control. Run the following script to enable them:

    ./setup_hooks.sh

License

Apache-2.0

Sponsor this project

 

Contributors

Languages

  • TypeScript 85.1%
  • Nix 7.7%
  • Shell 5.3%
  • Makefile 1.9%