0
0
Fork 0

Remove logging and unused function from TS

This commit is contained in:
Tyler-A 2020-04-23 20:08:12 -06:00
parent 58307fdd4c
commit e810e1a621
2 changed files with 4 additions and 41 deletions

View file

@ -64,7 +64,6 @@ export const GET_MESSAGE = async (id: string): Promise<msg_meta> => {
const WEBHOOK_POST = async (webhook: string, username: string, embed: any): Promise<object> => { const WEBHOOK_POST = async (webhook: string, username: string, embed: any): Promise<object> => {
console.log(2)
return await axios.post( return await axios.post(
`${DISCORD_WEBHOOK}?wait=true`, `${DISCORD_WEBHOOK}?wait=true`,
{ {
@ -73,7 +72,6 @@ const WEBHOOK_POST = async (webhook: string, username: string, embed: any): Prom
} }
) )
.then((response: any) => { .then((response: any) => {
console.log(3)
return response.data; return response.data;
}).catch((err:any) => {throw err}); }).catch((err:any) => {throw err});
}; };
@ -83,40 +81,4 @@ const WEBHOOK_POST = async (webhook: string, username: string, embed: any): Prom
export const POST_NEW_BRACKET = async (embed: any) => { export const POST_NEW_BRACKET = async (embed: any) => {
// @ts-ignore // @ts-ignore
return (await WEBHOOK_POST(DISCORD_WEBHOOK, DISCORD_WEBHOOK_USERNAME, embed)).id return (await WEBHOOK_POST(DISCORD_WEBHOOK, DISCORD_WEBHOOK_USERNAME, embed)).id
}
export const POST_WINNING_QUOTE = async (ctx: msg_meta, won: reaction|"TIE"|"NO_DATA") => {
let result: string;
console.log(1)
switch (won) {
case "NO_DATA":
case "TIE":
result = won;
break;
default:
result = `<:${won.emoji.name}:${won.emoji.id}>`
break;
}
console.log(4)
WEBHOOK_POST(
RESULT_WEBHOOK,
"Bracket Result",
{
title: "Bracket Results",
description: `Bracket Result: ${result}`,
fields: [
{
name: `Quote A:`,
value: ctx.quote_a.value,
inline: false
},
{
name: `Quote B:`,
value: ctx.quote_b.value,
inline: false
}
]
}
);
}; };

View file

@ -1,6 +1,7 @@
import { LOAD_MSG_ID, WRITE_MSG_ID } from "./database"; import { LOAD_MSG_ID, WRITE_MSG_ID } from "./database";
import { GET_MESSAGE, GET_QUOTE, POST_WINNING_QUOTE, POST_NEW_BRACKET } from "./api"; import { GET_MESSAGE, GET_QUOTE, POST_NEW_BRACKET } from "./api";
import { EMOJI_A_ID, EMOJI_B_ID, EMOJI_B_NAME, EMOJI_A_NAME } from "./config"; import { EMOJI_A_ID, EMOJI_B_ID, EMOJI_B_NAME, EMOJI_A_NAME } from "./config";
import { ADD_TO_DOCS } from "./docs";
const MAIN = async () => { const MAIN = async () => {
@ -22,7 +23,7 @@ const MAIN = async () => {
// Both quotes have had a reaction // Both quotes have had a reaction
let winning_emoji: reaction|"TIE"|"NO_DATA"; let winning_emoji: bracket_result;
if (emoji_a !== undefined && emoji_b !== undefined) { if (emoji_a !== undefined && emoji_b !== undefined) {
if (emoji_a!.count === emoji_b!.count) { if (emoji_a!.count === emoji_b!.count) {
winning_emoji = "TIE"; winning_emoji = "TIE";
@ -48,7 +49,7 @@ const MAIN = async () => {
// Push the winning quote to the result webhook // Push the winning quote to the result webhook
await POST_WINNING_QUOTE(msg, winning_emoji); ADD_TO_DOCS(msg, winning_emoji);
var new_quote_a: string, new_quote_b: string; var new_quote_a: string, new_quote_b: string;