diff options
author | Flam3rboy <34555296+Flam3rboy@users.noreply.github.com> | 2021-09-25 04:20:35 +0200 |
---|---|---|
committer | Flam3rboy <34555296+Flam3rboy@users.noreply.github.com> | 2021-09-25 04:20:35 +0200 |
commit | a83c9fe510d92fdccef264abc130e628b71e09db (patch) | |
tree | 699e80429929e9d9031ff0f3414981a9d6982e32 /api/src | |
parent | :bug: fix guild template create (diff) | |
download | server-a83c9fe510d92fdccef264abc130e628b71e09db.tar.xz |
:bug: fix #392
Diffstat (limited to 'api/src')
-rw-r--r-- | api/src/util/route.ts | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/api/src/util/route.ts b/api/src/util/route.ts index e7c7ed1c..45882d8a 100644 --- a/api/src/util/route.ts +++ b/api/src/util/route.ts @@ -81,10 +81,10 @@ export function route(opts: RouteOptions) { return async (req: Request, res: Response, next: NextFunction) => { if (opts.permission) { const required = new Permissions(opts.permission); - const permission = await getPermission(req.user_id, req.params.guild_id, req.params.channel_id); + req.permission = await getPermission(req.user_id, req.params.guild_id, req.params.channel_id); // bitfield comparison: check if user lacks certain permission - if (!permission.has(required)) { + if (!req.permission.has(required)) { throw DiscordApiErrors.MISSING_PERMISSIONS.withParams(opts.permission as string); } } |