✨ allow bot tokens
This commit is contained in:
parent
ae1fc50c84
commit
fe2d62cd47
@ -4,6 +4,7 @@ import { UserModel } from "../models";
|
|||||||
|
|
||||||
export function checkToken(token: string, jwtSecret: string): Promise<any> {
|
export function checkToken(token: string, jwtSecret: string): Promise<any> {
|
||||||
return new Promise((res, rej) => {
|
return new Promise((res, rej) => {
|
||||||
|
token = token.replace("Bot ", ""); // TODO: proper bot support
|
||||||
jwt.verify(token, jwtSecret, JWTOptions, async (err, decoded: any) => {
|
jwt.verify(token, jwtSecret, JWTOptions, async (err, decoded: any) => {
|
||||||
if (err || !decoded) return rej("Invalid Token");
|
if (err || !decoded) return rej("Invalid Token");
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user