0
0
Fork 0

Add methods for disabling the old quote bracket

This commit is contained in:
Oliver-Akins 2021-07-23 12:48:04 -06:00
parent 0d158babe2
commit 2f63b8d635
2 changed files with 37 additions and 0 deletions

View file

@ -0,0 +1,18 @@
import { DISCORD_API_URI } from "@/constants";
import { db } from "@/main";
import { Request, ResponseToolkit } from "@hapi/hapi";
import axios from "axios";
export default {
method: `DELETE`, path: `/{guild_id}/bracket/delete_message`,
async handler(request: Request, h: ResponseToolkit) {
let { guild_id: gID } = request.params;
let wh = db[gID].webhook;
let r = await axios.delete(
`${DISCORD_API_URI}/webhooks/${wh.id}/${wh.token}/messages/${db[gID].bracket.msg}`
);
return h.response(r.data).code(r.status);
},
}

View file

@ -0,0 +1,19 @@
import { Request, ResponseToolkit } from "@hapi/hapi";
import { DISCORD_API_URI } from "@/constants";
import { db } from "@/main";
import axios from "axios";
export default {
method: `DELETE`, path: `/{guild_id}/bracket/remove_components`,
async handler(request: Request, h: ResponseToolkit) {
let { guild_id: gID } = request.params;
let wh = db[gID].webhook;
let r = await axios.patch(
`${DISCORD_API_URI}/webhooks/${wh.id}/${wh.token}/messages/${db[gID].bracket.msg}`,
{ components: [] }
);
return h.response(r.data).code(r.status);
},
}