{"action":"created","issue":{"url":"https://api.github.com/repos/izy521/discord.io/issues/266","repository_url":"https://api.github.com/repos/izy521/discord.io","labels_url":"https://api.github.com/repos/izy521/discord.io/issues/266/labels{/name}","comments_url":"https://api.github.com/repos/izy521/discord.io/issues/266/comments","events_url":"https://api.github.com/repos/izy521/discord.io/issues/266/events","html_url":"https://github.com/izy521/discord.io/issues/266","id":321943010,"node_id":"MDU6SXNzdWUzMjE5NDMwMTA=","number":266,"title":"Could not add role","user":{"login":"paguii","id":18687395,"node_id":"MDQ6VXNlcjE4Njg3Mzk1","avatar_url":"https://avatars1.githubusercontent.com/u/18687395?v=4","gravatar_id":"","url":"https://api.github.com/users/paguii","html_url":"https://github.com/paguii","followers_url":"https://api.github.com/users/paguii/followers","following_url":"https://api.github.com/users/paguii/following{/other_user}","gists_url":"https://api.github.com/users/paguii/gists{/gist_id}","starred_url":"https://api.github.com/users/paguii/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/paguii/subscriptions","organizations_url":"https://api.github.com/users/paguii/orgs","repos_url":"https://api.github.com/users/paguii/repos","events_url":"https://api.github.com/users/paguii/events{/privacy}","received_events_url":"https://api.github.com/users/paguii/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":4,"created_at":"2018-05-10T14:03:29Z","updated_at":"2018-07-22T20:18:21Z","closed_at":"2018-05-10T15:47:56Z","author_association":"NONE","body":"Hello guys, I'm trying to make my bot to add a role to every people that connects in my server, so here is my code:\r\n\r\n```\r\nvar Discord = require('discord.io');\r\nvar logger = require('winston');\r\nvar auth = require('./data/discord-auth.json');\r\n\r\nvar serverID = \"325181137829756928\";\r\n\r\n// Roles\r\nvar roleAdmin = \"325182644516290561\";\r\nvar roleModLagger = \"325182958279327745\";\r\nvar roleLagadinhos = \"407632962289532938\";\r\n\r\n// Configure logger settings\r\nlogger.remove(logger.transports.Console);\r\nlogger.add(logger.transports.Console, {\r\n    colorize: true\r\n});\r\nlogger.level = 'debug';\r\n\r\n// Initialize Discord Bot\r\nvar bot = new Discord.Client({\r\n   token: auth.token,\r\n   autorun: true\r\n});\r\n\r\nbot.on('ready', function (evt) {\r\n    logger.info('Connected');\r\n    logger.info(bot.username + ' - (' + bot.id + ')');    \r\n});\r\n\r\nbot.on('guildMemberAdd', function(member){    \r\n    bot.addToRole({serverID: serverID, userID: member.id, roleID: roleLagadinhos}, function(err, response) {\r\n        if (err){\r\n            logger.error(err);\r\n        }else{\r\n            logger.info(response);\r\n        }\r\n    });\r\n});\r\n\r\nbot.on('message', function (user, userID, channelID, message, event) {\r\n    if (message.substring(0, 1) == '!') {\r\n        var args = message.substring(1).split(' ');\r\n        var cmd = args[0];\r\n       \r\n        args = args.splice(1);\r\n        switch(cmd){            \r\n            case 'comando':\r\n                bot.sendMessage({\r\n                    to: channelID,\r\n                    message: \"Você executou o seguinte comando: \" + cmd\r\n                });\r\n                break; \r\n\r\n            case 'event':\r\n                bot.sendMessage({\r\n                    to: channelID,\r\n                    message: \"Você executou o seguinte comando: \"\r\n                });\r\n                break; \r\n\r\n            default:\r\n                bot.sendMessage({\r\n                    to: channelID,\r\n                    message: \"Comando não reconhecido.\"\r\n                });                \r\n        }\r\n    }\r\n});\r\n```\r\n\r\nAnd this is the error I get:\r\n\r\n```\r\nResponseError: Could not add role\r\n    at handleResCB (C:\\Users\\PaGuii\\Desktop\\Bot\\Discordbot\\node_modules\\discord.io\\lib\\index.js:1403:10)\r\n    at C:\\Users\\PaGuii\\Desktop\\Bot\\Discordbot\\node_modules\\discord.io\\lib\\index.js:1178:3\r\n    at C:\\Users\\PaGuii\\Desktop\\Bot\\Discordbot\\node_modules\\discord.io\\lib\\index.js:1489:13\r\n    at Gunzip.onError (zlib.js:116:5)\r\n    at emitOne (events.js:116:13)\r\n    at Gunzip.emit (events.js:211:7)\r\n    at Gunzip.zlibOnError (zlib.js:156:8)\r\n```"},"comment":{"url":"https://api.github.com/repos/izy521/discord.io/issues/comments/406893773","html_url":"https://github.com/izy521/discord.io/issues/266#issuecomment-406893773","issue_url":"https://api.github.com/repos/izy521/discord.io/issues/266","id":406893773,"node_id":"MDEyOklzc3VlQ29tbWVudDQwNjg5Mzc3Mw==","user":{"login":"Gougerik","id":41547709,"node_id":"MDQ6VXNlcjQxNTQ3NzA5","avatar_url":"https://avatars1.githubusercontent.com/u/41547709?v=4","gravatar_id":"","url":"https://api.github.com/users/Gougerik","html_url":"https://github.com/Gougerik","followers_url":"https://api.github.com/users/Gougerik/followers","following_url":"https://api.github.com/users/Gougerik/following{/other_user}","gists_url":"https://api.github.com/users/Gougerik/gists{/gist_id}","starred_url":"https://api.github.com/users/Gougerik/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Gougerik/subscriptions","organizations_url":"https://api.github.com/users/Gougerik/orgs","repos_url":"https://api.github.com/users/Gougerik/repos","events_url":"https://api.github.com/users/Gougerik/events{/privacy}","received_events_url":"https://api.github.com/users/Gougerik/received_events","type":"User","site_admin":false},"created_at":"2018-07-22T20:18:21Z","updated_at":"2018-07-22T20:18:21Z","author_association":"NONE","body":"Hi. I saw your chat with **retrixe**.\r\nI have same problem as you but i drag default role under BOT role which have with OAuth2 added Administrator permission but Errors are still & when I tried `member.guild_id` after start bot.js it crashed in a moment :(     Can anybody help me?\r\n\r\n**Error:**\r\n```\r\n{ ResponseError: Could not add role\r\n    at handleResCB (D:\\NBT\\node_modules\\discord.io\\lib\\index.js:1401:10)\r\n    at D:\\NBT\\node_modules\\discord.io\\lib\\index.js:1176:3\r\n    at D:\\NBT\\node_modules\\discord.io\\lib\\index.js:1494:13\r\n    at Gunzip.onError (zlib.js:116:5)\r\n    at emitOne (events.js:116:13)\r\n    at Gunzip.emit (events.js:211:7)\r\n    at Gunzip.zlibOnError (zlib.js:156:8)\r\n  name: 'ResponseError',\r\n  statusCode: 404,\r\n  statusMessage: 'NOT FOUND',\r\n  response: { code: 10011, message: 'Unknown Role' } }\r\n```\r\n**Here is my code:**\r\n```\r\nbot.on('message', function (user, userID, channelID, message, evt) {\r\n    // Our bot needs to know if it will execute a command\r\n    // It will listen for messages that will start with `!`\r\n    if (message.substring(0, 1) == '/') {\r\n        var args = message.substring(1).split(' ');\r\n        var cmd = args[0];\r\n\r\n        args = args.splice(1);\r\n        switch (cmd) {\r\n            case 'donate':\r\n                var roledonate = '470679026923733028';\r\n                var serverid = '470557119230246922';\r\n                bot.addToRole({\r\n                    \"serverID\": serverid,\r\n                    \"userID\": userID,\r\n                    \"roleID\": roledonate\r\n                }, function (err, response) {\r\n                    if (err) console.error(err);\r\n                    bot.sendMessage({\r\n                        to: channelID,\r\n                        message: '**Error: **' + err\r\n\r\n                    });\r\n                });\r\n                break;\r\n       }\r\n    }\r\n});\r\n```"}}
{"actor":{"display_login":"Gougerik"}}