Fix answer sending and add push_discord config var.
This commit is contained in:
@@ -8,5 +8,7 @@
|
||||
"register": "/parse/users"
|
||||
},
|
||||
"discord_token": "NTA0MDQwNTI0NDI5MjYyODQ4.Dq_mEg.GC0SXdL0aj0hNvktuucA41QKzQo",
|
||||
"discord_channel": "504041066559963137"
|
||||
"discord_channel": "504041066559963137",
|
||||
"accept_userid": "111146692547473408",
|
||||
"PUSH_DISCORD": false
|
||||
}
|
||||
6
quiz.js
6
quiz.js
@@ -114,7 +114,7 @@ class Player {
|
||||
if (data && data[0] && data[0].game) {
|
||||
this.game = data[0].game;
|
||||
|
||||
if (this.game.currentState === 'GAME_LOBBY' && this.isMaster) {
|
||||
if (this.game.currentState === 'GAME_LOBBY' && this.isMaster && config.PUSH_DISCORD) {
|
||||
this.showQuestions();
|
||||
}
|
||||
}
|
||||
@@ -251,7 +251,7 @@ class Game {
|
||||
|
||||
sendAnswers(questionIndex) {
|
||||
const answer = this.answers[questionIndex] || 'split';
|
||||
if (['1', '2', '3'].includes(answer)) {
|
||||
if ([1, 2, 3].includes(answer)) {
|
||||
log.info(`Sending answer ${answer} for Question ${questionIndex + 1}.`);
|
||||
this.players.forEach(player => player.sendAnswer(parseInt(answer)));
|
||||
} else {
|
||||
@@ -317,7 +317,7 @@ client.on('message', (msg) => {
|
||||
|
||||
if (!guild || !channel) return;
|
||||
const { author, content } = msg;
|
||||
const { id, username } = author;
|
||||
const { id } = author;
|
||||
|
||||
if (id !== config.accept_userid) return;
|
||||
if (content.startsWith('!answers')) {
|
||||
|
||||
Reference in New Issue
Block a user