1.0.1 • Published 1 year ago

telebot-vercel v1.0.1

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

TeleBot bootstrap for Vercel

A simple bootstrap for TeleBot that will help you quickly develop or migrate your Telegram bot to Vercel

Both Serverless and Edge functions are supported !

How to use

Webhook receiver function:

import TeleBot from "telebot"
import {start} from "telebot-vercel"

const bot = new TeleBot(/* TELEGRAM_BOT_TOKEN */)

bot.on('text', msg => msg.reply.text(msg.text))

export default start({bot}) // Instead of bot.start()

Webhook setup function:

import TeleBot from "telebot"
import {setWebhook} from 'telebot-vercel'

const bot = new TeleBot(/* TELEGRAM_BOT_TOKEN */)

const path = 'api/webhook.mjs' // Receiver function path

export default setWebhook({bot, path}) // Instead of bot.setWebhook()

If you use plugins (including built-in ones), then you need to import them manually:

import TeleBot from "telebot"

import "telebot/plugins/shortReply.js"
import "telebot/plugins/regExpMessage.js"

... or specify them in vercel.json:

{
  "functions": {
    "api/**": {
      "includeFiles": "node_modules/telebot/plugins/**"
    }
  }
}

Complete usage example

You can also use additional options:

  • Multiple environments
  • Default hostname
  • Error output

Made with 💜 by Vladislav Ponomarev

1.0.1

1 year ago

1.0.0

1 year ago

0.0.10

1 year ago

0.0.9

1 year ago

0.0.8

1 year ago

0.0.5

1 year ago

0.0.7

1 year ago

0.0.6

1 year ago

0.0.4

2 years ago

0.0.3

2 years ago

0.0.1

2 years ago