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 telegrammessage
events.telegram.editedMessage
- matches when receiving telegrameditedMessage
events.telegram.channelPost
- matches when receiving telegramchannelPost
events.telegram.editedChannelPost
- matches when receiving telegrameditedChannelPost
events.telegram.inlineQuery
- matches when receiving telegraminlineQuery
events.telegram.chosenInlineResult
- matches when receiving telegramchosenInlineResult
events.telegram.callbackQuery
- matches when receiving telegramcallbackQuery
events.telegram.shippingQuery
- matches when receiving telegramshippingQuery
events.telegram.preCheckoutQuery
- matches when receiving telegrampreCheckoutQuery
events.telegram.poll
- matches when receiving telegrampoll
events.