diff --git a/chat-plugins/wifi.js b/chat-plugins/wifi.js index d9b5aea6a7..d0ee558297 100644 --- a/chat-plugins/wifi.js +++ b/chat-plugins/wifi.js @@ -45,12 +45,6 @@ const linkRegex = new RegExp( 'ig' ); -function checkPlural(variable, plural, singular) { - if (!plural) plural = 's'; - if (!singular) singular = ''; - return ((variable.length || variable) > 1 ? plural : singular); -} - function toPokemonId(str) { return str.toLowerCase().replace(/é/g, 'e').replace(/[^a-z0-9 /]/g, ''); } @@ -262,7 +256,7 @@ class QuestionGiveaway extends Giveaway { let ans = QuestionGiveaway.sanitizeAnswers(value); if (!ans.length) return user.sendTo(this.room, "You must specify at least one answer and it must not contain any special characters."); this.answers = ans; - user.sendTo(this.room, `The answer${checkPlural(ans, "s have", "has")} been changed to ${ans.join(', ')}.`); + user.sendTo(this.room, `The answer${Chat.plural(ans, "s have", "has")} been changed to ${ans.join(', ')}.`); } end(force) { @@ -280,7 +274,7 @@ class QuestionGiveaway extends Giveaway { this.clearTimer(); this.room.modlog(`${this.winner.name} won ${this.giver.name}'s giveaway for a "${this.prize}"`); this.send(this.generateWindow(`
${Chat.escapeHTML(this.winner.name)} won the giveaway! Congratulations!
` + - `${this.question}
Correct answer${checkPlural(this.answers)}: ${this.answers.join(', ')}
${this.question}
Correct answer${Chat.plural(this.answers)}: ${this.answers.join(', ')}
The giveaway was forcibly ended.
'); this.room.send("The giveaway was forcibly ended."); } else { - this.changeUhtml(`The giveaway has ended! Scroll down to see the winner${checkPlural(this.winners)}.
`); + this.changeUhtml(`The giveaway has ended! Scroll down to see the winner${Chat.plural(this.winners)}.
`); this.phase = 'ended'; let winnerNames = this.winners.map(winner => winner.name).join(', '); this.room.modlog(`${winnerNames} won ${this.giver.name}'s giveaway for "${this.prize}"`); - this.send(this.generateWindow(`Lottery Draw
${Object.keys(this.joined).length} users joined the giveaway.
Our lucky winner${checkPlural(this.winners)}: ${Chat.escapeHTML(winnerNames)}! Congratulations!
Lottery Draw
${Object.keys(this.joined).length} users joined the giveaway.
Our lucky winner${Chat.plural(this.winners)}: ${Chat.escapeHTML(winnerNames)}! Congratulations!