discordjs / discord.js

A powerful JavaScript library for interacting with the Discord API
https://discord.js.org
Apache License 2.0
25.5k stars 3.97k forks source link

TypeError: Cannot read property 'resolver' of undefined #145

Closed Lord-Ptolemy closed 8 years ago

Lord-Ptolemy commented 8 years ago

Discord.js: NPM 5.3.2 Node: LTS 4.2.3

[Wed, 13 Jan 2016 11:15:12 GMT] MESSAGE UPDATE: Technic[42463947818795009]/help[96563656271093760]/TechniKhitty[115539250212110339] updated message. <@136801276750069760>, In order to update to Java 64-Bit, please go to the link below and download the version for your computer. If using Windows, please use the version `Windows Offline (64-Bit)`. http://java.com/en/download/manual.jsp --> <@136801276750069760>, In order to update to Java 64-Bit, please go to the link below and download the version for your computer. If using Windows, please use the version `Windows Offline (64-Bit)`. http://java.com/en/download/manual.jsp
[Wed, 13 Jan 2016 11:15:12 GMT] VOICE LEAVE: Sheen[115212820152451078] left voice channel Voice 2[97805743935213568]
C:\Users\Berwyn\node_modules\discord.js\lib\Structures\Server.js:1
(function (exports, require, module, __filename, __dirname) { "use strict";exports.__esModule = true;var _createClass=(function(){function defineProperties(target,props){for(var i=0;i < props.length;i++) {var descriptor=props[i];descriptor.enumerable = descriptor.enumerable || false;descriptor.configurable = true;if("value" in descriptor)descriptor.writable = true;Object.defineProperty(target,descriptor.key,descriptor);}}return function(Constructor,protoProps,staticProps){if(protoProps)defineProperties(Constructor.prototype,protoProps);if(staticProps)defineProperties(Constructor,staticProps);return Constructor;};})();function _interopRequireDefault(obj){return obj && obj.__esModule?obj:{"default":obj};}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function");}}function _inherits(subClass,superClass){if(typeof superClass !== "function" && superClass !== null

TypeError: Cannot read property 'resolver' of undefined
    at Server.rolesOfUser (C:\Users\Berwyn\node_modules\discord.js\lib\Structures\Server.js:1:4834)
    at Server.rolesOf (C:\Users\Berwyn\node_modules\discord.js\lib\Structures\Server.js:1:5019)
    at TextChannel.permissionsOf (C:\Users\Berwyn\node_modules\discord.js\lib\Structures\ServerChannel.js:1:2116)
    at Client.<anonymous> (C:\Users\Berwyn\Desktop\Discord_Bots\Rosalina_V2\index.js:312:51)
    at emitOne (events.js:77:13)
    at Client.emit (events.js:169:7)
    at WebSocket.websocket.onmessage (C:\Users\Berwyn\node_modules\discord.js\lib\Client\InternalClient.js:59:15)
    at WebSocket.onMessage (C:\Users\Berwyn\node_modules\discord.js\node_modules\ws\lib\WebSocket.js:418:14)
    at emitTwo (events.js:87:13)
    at WebSocket.emit (events.js:172:7)

This crash has been occurring for awhile, but quite rarely.

Code

if (!message.channel.isPrivate) {
        if(message.channel.server.id !== '42463947818795009') {
            var bot_permissions = message.channel.permissionsOf(bot.user.id); //line 312
            var bot_can_invite = bot_permissions.hasPermission("createInstantInvite");
            var bot_can_kick = bot_permissions.hasPermission("kickMembers");
            var bot_can_ban = bot_permissions.hasPermission("banMembers");
            var bot_can_manage_roles = bot_permissions.hasPermission("manageRoles");
            var bot_can_manage_permissions = bot_permissions.hasPermission("managePermissions");
            var bot_can_manage_channels = bot_permissions.hasPermission("manageChannels");
            var bot_can_manage_channel = bot_permissions.hasPermission("manageChannel");
            var bot_can_manage_server = bot_permissions.hasPermission("manageServer");
            var bot_can_read = bot_permissions.hasPermission("readMessages");
            var bot_can_send = bot_permissions.hasPermission("sendMessages");
            var bot_can_send_tts = bot_permissions.hasPermission("sendTTSMessages");
            var bot_can_manage_messages = bot_permissions.hasPermission("manageMessages");
            var bot_can_embed = bot_permissions.hasPermission("embedLinks");
            var bot_can_attach = bot_permissions.hasPermission("attachFiles");
            var bot_can_read_history = bot_permissions.hasPermission("readMessageHistory");
            var bot_can_mention_everyone = bot_permissions.hasPermission("mentionEveryone");
            var bot_can_voice_connect = bot_permissions.hasPermission("voiceConnect");
            var bot_can_voice_speak = bot_permissions.hasPermission("voiceSpeak");
            var bot_can_voice_mute = bot_permissions.hasPermission("voiceMuteMembers");
            var bot_can_voice_deafen = bot_permissions.hasPermission("voiceDeafenMembers");
            var bot_can_voice_move = bot_permissions.hasPermission("voiceMoveMembers");
            var bot_can_voice_use_vad = bot_permissions.hasPermission("voiceUseVAD");
            var userid = message.author.id;
            var serverid = message.channel.server.id;
//more code
khionu commented 8 years ago

"Discord.js: NPM 3.5.2" Transposition?

Lord-Ptolemy commented 8 years ago

Fixed. I switched the 5 and 3.