Telegram Routings
Bottender offers a bunch of helpers to route within your Telegram or multi-platform application. For example, you may use Telegram particular routes within your router:
const { router, telegram } = require('bottender/router');
function App() {
return router([
telegram.message(HandleMessage),
telegram.editedMessage(HandleEditedMessage),
telegram.channelPost(HandleChannelPost),
telegram.editedChannelPost(HandleEditedChannelPost),
telegram.inlineQuery(HandleInlineQuery),
telegram.chosenInlineResult(HandleChosenInlineResult),
telegram.callbackQuery(HandleCallbackQuery),
telegram.shippingQuery(HandleShippingQuery),
telegram.preCheckoutQuery(HandlePreCheckoutQuery),
telegram.poll(HandlePoll),
telegram(HandleTelegram),
]);
}
async function HandleMessage(context) {
/* skip... */
}
async function HandleEditedMessage(context) {
/* skip... */
}
async function HandleChannelPost(context) {
/* skip... */
}
async function HandleEditedChannelPost(context) {
/* skip... */
}
async function HandleInlineQuery(context) {
/* skip... */
}
async function HandleChosenInlineResult(context) {
/* skip... */
}
async function HandleCallbackQuery(context) {
/* skip... */
}
async function HandleShippingQuery(context) {
/* skip... */
}
async function HandlePreCheckoutQuery(context) {
/* skip... */
}
async function HandlePoll(context) {
/* skip... */
}
async function HandleTelegram(context) {
/* skip... */
}
All available routes in telegram that recognize different kind of events:
telegram- matches when receiving any telegram events.telegram.message- matches when receiving telegrammessageevents.telegram.editedMessage- matches when receiving telegrameditedMessageevents.telegram.channelPost- matches when receiving telegramchannelPostevents.telegram.editedChannelPost- matches when receiving telegrameditedChannelPostevents.telegram.inlineQuery- matches when receiving telegraminlineQueryevents.telegram.chosenInlineResult- matches when receiving telegramchosenInlineResultevents.telegram.callbackQuery- matches when receiving telegramcallbackQueryevents.telegram.shippingQuery- matches when receiving telegramshippingQueryevents.telegram.preCheckoutQuery- matches when receiving telegrampreCheckoutQueryevents.telegram.poll- matches when receiving telegrampollevents.