Refactor codes [commands.ts]
This commit is contained in:
parent
9ad3f97125
commit
d4599d472a
1 changed files with 1 additions and 3 deletions
|
@ -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) => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue