puyoxyz / announcer

Discord bot for announcing stuff in embeds.
BSD 2-Clause "Simplified" License
2 stars 3 forks source link

Showing Error even i have role #6

Closed asn23 closed 3 years ago

asn23 commented 3 years ago

/home/runner/announcer-1/main.js:26 if (!message.member.roles.find(r => r.name === config.bot.allowedRoleName)) return; // Stop running command if user doesn't have unb-mod ^

TypeError: Cannot read property 'roles' of null at Client. (/home/runner/announcer-1/main.js:26:29) at Client.emit (events.js:314:20) at MessageCreateHandler.handle (/home/runner/announcer-1/node_modules/discord.js/src/client/websocket/packets/handlers/MessageCreate.js:9:34) at WebSocketPacketManager.handle (/home/runner/announcer-1/node_modules/discord.js/src/client/websocket/packets/WebSocketPacketManager.js:105:65) at WebSocketConnection.onPacket (/home/runner/announcer-1/node_modules/discord.js/src/client/websocket/WebSocketConnection.js:333:35) at WebSocketConnection.onMessage (/home/runner/announcer-1/node_modules/discord.js/src/client/websocket/WebSocketConnection.js:296:17) at WebSocket.onMessage (/home/runner/announcer-1/node_modules/ws/lib/event-target.js:120:16) at WebSocket.emit (events.js:314:20) at Receiver.receiverOnMessage (/home/runner/announcer-1/node_modules/ws/lib/websocket.js:789:20) at Receiver.emit (events.js:314:20

===========================================
config file- (i hided TOKEN)

const config = { bot: { prefix: 'dh!', // Put the prefix you want commands to start with here token: '#################################################', // Put your Discord Bot Token here gameName: 'discord.gg/freenitros', // Put the playing status you want here allowedRoleName: 'DhBot' // Put the name of the role you want to be able to use the bot here. You can't put "@everyone", that won't work. },

configVersion: '3' //Don't change this!

}

module.exports = config;

puyoxyz commented 3 years ago

use discohook, i don't update this anymore, the problem you're having is your discordjs is too new for this code, just use discohook i'm not gonna update it anyways