Skip to content

Commit

Permalink
🐛 Fix remove role code
Browse files Browse the repository at this point in the history
  • Loading branch information
Androz2091 committed Mar 9, 2021
1 parent 5540148 commit 3fecd7d
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/blocks/discord/roles/remove_role.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,11 @@ Blockly.JavaScript[blockName] = function(block) {
const role = Blockly.JavaScript.valueToCode(block, "ROLE", Blockly.JavaScript.ORDER_ATOMIC);
const member = Blockly.JavaScript.valueToCode(block, "MEMBER", Blockly.JavaScript.ORDER_ATOMIC);
if(block.getInput("ROLE").connection.targetConnection){
const roleType = block.getInput("ROLE").connection.targetConnection.getSourceBlock().ouputConnection.check_[0];
const roleType = block.getInput("ROLE").connection.targetConnection.getSourceBlock().outputConnection.check_ ?
block.getInput("ROLE").connection.targetConnection.getSourceBlock().outputConnection.check_[0] :
null;
if(roleType === "String"){
const code = `${member}.roles.remove(${member}.guild.roles.cache.find((role) => role.id === ${role} || role.name === ${role} || '@'+role.name === ${role})):\n`;
const code = `${member}.roles.remove(${member}.guild.roles.cache.find((role) => role.id === ${role} || role.name === ${role} || '@'+role.name === ${role}));\n`;
return code;
} else {
const code = `${member}.roles.remove(${role});\n`;
Expand Down

0 comments on commit 3fecd7d

Please sign in to comment.