0
0
Fork 0

refactor how the try_thread variable is created

This commit is contained in:
Oliver-Akins 2021-08-28 23:46:57 -06:00
parent caf8ad7a5d
commit d4100d0adc

View file

@ -7,7 +7,7 @@ export default {
method: `GET`, path: `/{guild_id}/bracket/isTied`, method: `GET`, path: `/{guild_id}/bracket/isTied`,
async handler(request: Request, h: ResponseToolkit) { async handler(request: Request, h: ResponseToolkit) {
let { guild_id: gID } = request.params; let { guild_id: gID } = request.params;
let { try_thread } = request.query; let try_thread = request.query?.try_thread === `true`;
let r = await request.server.inject({ let r = await request.server.inject({
url: `/${gID}/bracket/winners`, url: `/${gID}/bracket/winners`,
@ -32,7 +32,7 @@ export default {
let params: execute_webhook_query_params = { wait: true }; let params: execute_webhook_query_params = { wait: true };
// Check if the user is wanting to use a thread notification // Check if the user is wanting to use a thread notification
if (try_thread === `true` && config.guilds[gID].bot_token) { if (try_thread && config.guilds[gID].bot_token) {
try { try {
await axios.get( await axios.get(
`${DISCORD_API_URI}/channels/${bracket.msg}`, `${DISCORD_API_URI}/channels/${bracket.msg}`,