This is the template project that's checked out and configured when you run the bando-up command from ljsthw-bandolier. This is where the code really lives.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
bandolier-template/api/discord.js

26 lines
647 B

import queues from "../lib/queues.js";
import { API } from "../lib/api.js";
import logging from "../lib/logging.js";
const log = logging.create(import.meta.url);
export const get = async (req, res) => {
const api = new API(req, res);
api.reply(200, { discord_sent: api.req.user.discord_sent });
}
get.authenticated = true;
export const post = async (req, res) => {
const api = new API(req, res);
log.debug(`Discord request received from user ${ req.user.id }`);
const discord_q = queues.create("discord/send_invite");
discord_q.add({user_id: api.req.user.id});
api.reply(200, { message: "OK" });
}
post.authenticated = true;