bing-chat-telegram/src/check-origin.ts
Udit Karode 77c704db49
init
2023-04-08 10:17:49 +05:30

10 lines
303 B
TypeScript

import { Context, Middleware } from "telegraf";
export const checkOrigin =
(allowedIds: readonly number[] | number[]): Middleware<Context> =>
(ctx, next) => {
const chatId = ctx.chat?.id;
if (chatId && allowedIds.includes(chatId)) next();
else ctx.reply("Unable to proceed in this chat!");
};