Browse Source

Return round URL on generation

pull/9/head
Abheek Dhawan 4 years ago
parent
commit
e656a8fff9
  1. 11
      bot/awesomescibo.js

11
bot/awesomescibo.js

@ -307,11 +307,7 @@ function sendHelpMessage(message) {
} }
async function generateRound(message) { async function generateRound(message) {
fs.writeFile("index.html", "<h1>Here's your round!</h1>", (error) => { const generatingMessage = message.channel.send("Generating...");
if (error) {
console.log(error);
}
});
let i; let i;
let finalizedHTML = '<html><body style="width: 70%; margin-left: auto; margin-right: auto;"><h2 style="text-align: center; text-decoration: underline overline; padding: 7px;">ROUND GENERATED BY AWESOMESCIBO USING THE SCIBOWLDB API</h2>'; let finalizedHTML = '<html><body style="width: 70%; margin-left: auto; margin-right: auto;"><h2 style="text-align: center; text-decoration: underline overline; padding: 7px;">ROUND GENERATED BY AWESOMESCIBO USING THE SCIBOWLDB API</h2>';
for (i = 1; i < 26; i++) { for (i = 1; i < 26; i++) {
@ -342,15 +338,16 @@ async function generateRound(message) {
htmlContent: finalizedHTML, htmlContent: finalizedHTML,
requestedBy: message.author.id, requestedBy: message.author.id,
}); });
newGeneratedRound.save((err) => newGeneratedRound.save((err, round) =>
err err
? console.log("Error creating saving generated round content") ? console.log("Error creating saving generated round content")
: console.log("Sucessfully created new entry for the generated round") : 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) { async function startScoring(message) {

Loading…
Cancel
Save