From e810e1a621be60603ea43b73e67c3f1d66c3fdc7 Mon Sep 17 00:00:00 2001 From: Tyler-A Date: Thu, 23 Apr 2020 20:08:12 -0600 Subject: [PATCH] Remove logging and unused function from TS --- src/api.ts | 38 -------------------------------------- src/main.ts | 7 ++++--- 2 files changed, 4 insertions(+), 41 deletions(-) diff --git a/src/api.ts b/src/api.ts index 0fff18a..cb2fa93 100644 --- a/src/api.ts +++ b/src/api.ts @@ -64,7 +64,6 @@ export const GET_MESSAGE = async (id: string): Promise => { const WEBHOOK_POST = async (webhook: string, username: string, embed: any): Promise => { - console.log(2) return await axios.post( `${DISCORD_WEBHOOK}?wait=true`, { @@ -73,7 +72,6 @@ const WEBHOOK_POST = async (webhook: string, username: string, embed: any): Prom } ) .then((response: any) => { - console.log(3) return response.data; }).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) => { // @ts-ignore 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 - } - ] - } - ); }; \ No newline at end of file diff --git a/src/main.ts b/src/main.ts index 5099b87..baa0e7a 100644 --- a/src/main.ts +++ b/src/main.ts @@ -1,6 +1,7 @@ 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 { ADD_TO_DOCS } from "./docs"; const MAIN = async () => { @@ -22,7 +23,7 @@ const MAIN = async () => { // 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!.count === emoji_b!.count) { winning_emoji = "TIE"; @@ -48,7 +49,7 @@ const MAIN = async () => { // 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;