Code:
admin = guild.roles.find("name", config.adminRole);
^
TypeError: Cannot read property 'roles' of null
at Client.client.on (C:\Users\dahou\Desktop\Development files\Sourcemod (All)\reportBot\Bot Files\reportBot.js:45:16)
at Client.emit (events.js:194:15)
at WebSocketConnection.triggerReady (C:\Users\dahou\Desktop\Development files\Sourcemod (All)\reportBot\Bot Files\node_modules\discord.js\src\client\websocket\WebSocketConnection.js:125:17)
at WebSocketConnection.checkIfReady (C:\Users\dahou\Desktop\Development files\Sourcemod (All)\reportBot\Bot Files\node_modules\discord.js\src\client\websocket\WebSocketConnection.js:141:61)
at GuildCreateHandler.handle (C:\Users\dahou\Desktop\Development files\Sourcemod (All)\reportBot\Bot Files\node_modules\discord.js\src\client\websocket\packets\handlers\GuildCreate.js:13:31)
at WebSocketPacketManager.handle (C:\Users\dahou\Desktop\Development files\Sourcemod (All)\reportBot\Bot Files\node_modules\discord.js\src\client\websocket\packets\WebSocketPacketManager.js:103:65)
at WebSocketConnection.onPacket (C:\Users\dahou\Desktop\Development files\Sourcemod (All)\reportBot\Bot Files\node_modules\discord.js\src\client\websocket\WebSocketConnection.js:333:35)
at WebSocketConnection.onMessage (C:\Users\dahou\Desktop\Development files\Sourcemod (All)\reportBot\Bot Files\node_modules\discord.js\src\client\websocket\WebSocketConnection.js:296:17)
at WebSocket.onMessage (C:\Users\dahou\Desktop\Development files\Sourcemod (All)\reportBot\Bot Files\node_modules\discord.js\node_modules\ws\lib\event-target.js:120:16)
at WebSocket.emit (events.js:189:13)
I am getting this error. I honestly don't know what the problem is since I have a role set in the config. I didn't move any of the Parenthesis, Commas, ect. as far as I can tell. Please help!
My config:
Code:
var config = {
admins: ["-snipped-"], // people without the admin role that are allowed to use the bot, this is their discord ID
serverID: "-snipped-", // discord server ID
host: "", // MySQL IP or hostname
user: "admin", // MySQL username
password: "", // MySQL password
database: "garbage_reports", // MySQL database
reportsDB: "reports", // MySQL report location can't really change this
blockedDB: "blocked", // MySQL blocked location can't really change this
channelName: "reports", // Channel the bot will post reports in, create the channel before running the bot!
commandStr: "!ms ", // !ms block 76561198023897791
SteamAPIKey: "-snipped-", // SteamAPI Key https://steamcommunity.com/dev/api
adminRole: "Owner", // The role name of people that should be able to use the bot
token: "-snipped-" // Bot Token
}
module.exports = config;