Browse Source

Fix scoring message filter

master
Abheek Dhawan 4 years ago
parent
commit
0c591c0f93
  1. 4
      index.js

4
index.js

@ -22,7 +22,7 @@ async function startScoring(message) {
let scoreB = 0; let scoreB = 0;
const scoreboard = await message.channel.send(`Here's the score:\nTeam A: ${scoreA}\nTeam B: ${scoreB}`) const scoreboard = await message.channel.send(`Here's the score:\nTeam A: ${scoreA}\nTeam B: ${scoreB}`)
.then((scoreboard) => { .then((scoreboard) => {
const filter = m => m.content.includes('do be'); const filter = m => m.content.includes('$score');
const collector = message.channel.createMessageCollector(filter, { time: 1500000 }); const collector = message.channel.createMessageCollector(filter, { time: 1500000 });
collector.on('collect', m => { collector.on('collect', m => {
if (m.content.toLowerCase() === "$score a+4") { if (m.content.toLowerCase() === "$score a+4") {
@ -41,7 +41,7 @@ async function startScoring(message) {
//m.delete({ timeout: 1000 }).catch(console.error); //m.delete({ timeout: 1000 }).catch(console.error);
scoreB += 10; scoreB += 10;
scoreboard.channel.send(`Here's the score:\nTeam A: ${scoreA}\nTeam B: ${scoreB}`).catch(console.error); scoreboard.channel.send(`Here's the score:\nTeam A: ${scoreA}\nTeam B: ${scoreB}`).catch(console.error);
} else if (m.content === "do be scoring stop") { } else if (m.content === "$score finish") {
//m.delete({ timeout: 1000 }).catch(console.error); //m.delete({ timeout: 1000 }).catch(console.error);
scoreboard.delete({ timeout: 1000 }); scoreboard.delete({ timeout: 1000 });
m.channel.send(`**FINAL SCORE:**\nTeam A: ${scoreA}\nTeam B: ${scoreB}`).catch(console.error); m.channel.send(`**FINAL SCORE:**\nTeam A: ${scoreA}\nTeam B: ${scoreB}`).catch(console.error);

Loading…
Cancel
Save