question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

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:closed
  • Created 7 years ago
  • Comments:10 (6 by maintainers)

github_iconTop GitHub Comments

5reactions
abalabahahacommented, Aug 11, 2016

Although the example code should have that check prepared

2reactions
mnlkrscommented, Aug 11, 2016

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;

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found