Refactor codes [commands.ts]

This commit is contained in:
Sudo Space 2025-04-25 10:48:30 +03:30
parent 9ad3f97125
commit d4599d472a

View file

@ -1,7 +1,6 @@
import { Composer } from "grammy";
import type { UserContext } from "types/type";
import type { NextFunction } from "grammy";
import db from "database";
@ -18,12 +17,11 @@ it support currently:
SoundCloud`);
});
function auth(ctx: UserContext, next: NextFunction) {
function auth(ctx: UserContext) {
const user = ctx.session.user;
if (user?.role != "ADMIN") {
return ctx.reply("Sorry you aren't admin.");
}
next();
}
commands.command("clean", auth, async (ctx) => {