This commit is contained in:
Udit Karode
2023-04-08 10:17:49 +05:30
commit 77c704db49
14 changed files with 821 additions and 0 deletions

9
src/check-origin.ts Normal file
View File

@@ -0,0 +1,9 @@
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!");
};