examples/permissions/adminbot.js broken
See original GitHub issue$ node test.js
Ready to begin! Serving in 13 channels
E:\plasma!\plasma-chan\discord\test.js:31
var role = msg.server.roles.get("name", "good people");
^
TypeError: Cannot read property 'roles' of undefined
at Client.<anonymous> (E:\plasma!\plasma-chan\discord\test.js:31:24)
at emitOne (events.js:96:13)
at Client.emit (events.js:188:7)
at WebSocket.websocket.onmessage (E:\plasma!\plasma-chan\discord\node_modules\discord.js\lib\Client\InternalClient.js:90:15)
at WebSocket.onMessage (E:\plasma!\plasma-chan\discord\node_modules\ws\lib\WebSocket.js:442:14)
at emitTwo (events.js:106:13)
at WebSocket.emit (events.js:191:7)
at Receiver.ontext (E:\plasma!\plasma-chan\discord\node_modules\ws\lib\WebSocket.js:841:10)
at E:\plasma!\plasma-chan\discord\node_modules\ws\lib\Receiver.js:536:18
at Receiver.applyExtensions (E:\plasma!\plasma-chan\discord\node_modules\ws\lib\Receiver.js:371:5)
Issue Analytics
- State:
- Created 7 years ago
- Comments:10 (6 by maintainers)
Top Results From Across the Web
Editing discord role permissions. (discord.js) - Stack Overflow
I am trying to have it so it gives the role the admin perm. This is of course assuming that the bot also...
Read more >Discord Js Manage Roles Permission Missing Even ... - ADocLib
Forbidden: FORBIDDEN (status code: 403): Missing Permissions Check to make sure the bot user has permission to add the admin role to If...
Read more >How Roles cause Missing Permission Errors in Discord.js
After struggling to understand why my Discord.js bot was throwing a DiscordAPIError: Missing Permissions even with full admin permissions, I found out that ......
Read more >Bot permissions for a role
Assign bot permissions when creating a role with the View my bots feature permission.
Read more >Code Your Own Discord Bot - Kick & Ban Commands (2021)
Kick and Ban commands are very important to any admin discord bot. In this video, you will learn the easiest and safest way...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Although the example code should have that check prepared
Your bot probably got DM’d, hence no server. To avoid this check for a server and return if the command is reliant on one, for example like this
if(!msg.server) return;