Skip to content

ʕ •́؈•̀) TypeScript template for starting a telegram bot using telegrafjs with Cloudflare Workers

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE_APACHE
MIT
LICENSE_MIT
Notifications You must be signed in to change notification settings

iisteev/worker-telegrambot-template

 
 

Repository files navigation

ʕ •́؈•̀) worker-telegrambot-template

A batteries included template for kick starting a Telegram Bot using telegraf.js with Cloudflare worker project.

🔋 Getting Started

This template is meant to be used with Wrangler. If you are not already familiar with the tool, we recommend that you install the tool and configure it to work with your Cloudflare account. Documentation can be found here.

To generate using Wrangler, run this command:

wrangler generate my-ts-project https://github.com/iisteev/worker-telegrambot-template

You should also put your telegram bot token in a secret. The already defined variable can be found in bindings.d.ts

To create a secret, run this command and then paste your token:

wrangler secret put TG_BOT_API_TOKEN

PS: Sometimes creating a secret with wrangler before creating a worker fails, you should create your worker and then create the secret.

👩 💻 Developing

src/index.js calls the request handler in src/handler.ts, and will return the request method for the given request.

🧪 Testing

This template comes with mocha tests. npm test will run your tests.

✏️ Formatting

This template uses prettier to format the project. To invoke, run npm run format.

👀 Previewing and Publishing

For information on how to preview and publish your worker, please see the Wrangler docs.

🤢 Issues

If you run into issues with this specific project, please feel free to file an issue here. If the problem is with Wrangler, please file an issue here.

⚠️ Caveats

The service-worker-mock used by the tests is not a perfect representation of the Cloudflare Workers runtime. It is a general approximation. We recommend that you test end to end with wrangler dev in addition to a staging environment to test things before deploying.

About

ʕ •́؈•̀) TypeScript template for starting a telegram bot using telegrafjs with Cloudflare Workers

Resources

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE_APACHE
MIT
LICENSE_MIT

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 51.1%
  • TypeScript 48.9%