LakeYS / Discord-Trivia-Bot

TriviaBot: Play trivia in Discord! Powered by discord.js and OpenTDB, with 24 categories and three modes of play.
http://lakeys.net/triviabot/
Apache License 2.0
84 stars 39 forks source link

"command-whitelist" config option does not initialize as an array #168

Closed LakeYS closed 5 years ago

LakeYS commented 5 years ago
  if(((msg.member !== null && msg.member.permissions.has("MANAGE_GUILD")) || msg.channel.type === "dm" || getConfigVal("command-whitelist", msg.channel).length > 0) && getConfigVal("disable-admin-commands", msg.channel) !== true) {
                                                                                                                                                        ^

TypeError: Cannot read property 'length' of undefined
    at parseCommand (/home/server/TriviaBot/triviabot.js:1176:153)
    at Object.Trivia.parse (/home/server/TriviaBot/triviabot.js:1463:5)
    at Client.global.client.on (/home/server/TriviaBot/shard.js:160:19)
    at Client.emit (events.js:193:13)
    at MessageCreateHandler.handle (/home/server/TriviaBot/node_modules/discord.js/src/client/websocket/packets/handlers/MessageCreate.js:9:34)
    at WebSocketPacketManager.handle (/home/server/TriviaBot/node_modules/discord.js/src/client/websocket/packets/WebSocketPacketManager.js:105:65)
    at WebSocketConnection.onPacket (/home/server/TriviaBot/node_modules/discord.js/src/client/websocket/WebSocketConnection.js:333:35)
    at WebSocketConnection.onMessage (/home/server/TriviaBot/node_modules/discord.js/src/client/websocket/WebSocketConnection.js:296:17)
    at WebSocket.onMessage (/home/server/TriviaBot/node_modules/ws/lib/event-target.js:120:16)
    at WebSocket.emit (events.js:193:13)

Workaround for the error: Go into config and add this line: "command-whitelist": []

LakeYS commented 5 years ago

EDIT: Test complete, will release in hotfix 1.6.3