diff --git a/bot/awesomescibo.js b/bot/awesomescibo.js index d0f1937..b6def1a 100755 --- a/bot/awesomescibo.js +++ b/bot/awesomescibo.js @@ -307,11 +307,7 @@ function sendHelpMessage(message) { } async function generateRound(message) { - fs.writeFile("index.html", "

Here's your round!

", (error) => { - if (error) { - console.log(error); - } - }); + const generatingMessage = message.channel.send("Generating..."); let i; let finalizedHTML = '

ROUND GENERATED BY AWESOMESCIBO USING THE SCIBOWLDB API

'; for (i = 1; i < 26; i++) { @@ -342,15 +338,16 @@ async function generateRound(message) { htmlContent: finalizedHTML, requestedBy: message.author.id, }); - newGeneratedRound.save((err) => + newGeneratedRound.save((err, round) => err ? console.log("Error creating saving generated round content") : console.log("Sucessfully created new entry for the generated round") + + message.channel.fetch(generatingMessage.id).edit(`https://api.adawesome.tech/round/${round._id.toString()}`); ); } }); } - message.channel.send("Check database"); } async function startScoring(message) {