0
0
Fork 0

Allow channel owners to run mod-only subcommands

This commit is contained in:
Oliver-Akins 2023-02-20 20:22:21 -07:00
parent 70d7350474
commit c255ab137c

View file

@ -3,6 +3,11 @@ import { Request, ServerRoute } from "@hapi/hapi";
import boom from "@hapi/boom";
import Joi from "joi";
const MOD_LEVELS = [
`moderator`,
`owner`,
];
interface meta {
args: string[];
channel: string;
@ -118,7 +123,7 @@ const route: ServerRoute = {
return `Invalid subcommand. Valid options: ${Object.keys(subcommands).join(`, `)}`;
};
if (subcommands[sc].modOnly && userData.get(`userLevel`) != `moderator`) {
if (subcommands[sc].modOnly && !MOD_LEVELS.includes(userData.get(`userLevel`) ?? ``)) {
return `That command is mod-only! :P`;
};