UNPKG

discordbotlist

Version:

Integrate with discordbotlist.com and support voting rewards and promote your bot's stats on the website.

22 lines (21 loc) 633 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.upvoteListener = void 0; function upvoteListener(secret, listener) { return async (req, res, next) => { if (req.header("Authorization") !== secret) return res.sendStatus(401); try { req.body.time = new Date(); await listener(req.body, req, res, next); if (!res.headersSent) res.sendStatus(200); } catch (e) { console.error(e); res.sendStatus(500); } next(); }; } exports.upvoteListener = upvoteListener;