Skip to content

Commit

Permalink
Trivia: Delete questions by ID (smogon#4042)
Browse files Browse the repository at this point in the history
  • Loading branch information
CheeseMuffin authored and Zarel committed Oct 6, 2017
1 parent f98672b commit f46b9bb
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion chat-plugins/trivia.js
Original file line number Diff line number Diff line change
Expand Up @@ -1174,8 +1174,9 @@ const commands = {
if (!question) return this.errorReply(`'${target}' is not a valid argument. View /trivia help questions for more information.`);

let questions = triviaData.questions;
let questionID = toId(question);
for (let i = 0; i < questions.length; i++) {
if (questions[i].question === question) {
if (toId(questions[i].question) === questionID) {
questions.splice(i, 1);
writeTriviaData();
return this.privateModCommand(`(${user.name} removed question '${target}' from the question database.)`);
Expand Down

0 comments on commit f46b9bb

Please sign in to comment.