Trebossa

Untitled

Apr 15th, 2019
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.43 KB | None | 0 0
  1. {
  2. "name": "reactionRev",
  3. "temp": "msgReaction",
  4. "event-type": "29",
  5. "_id": "ZQmhC",
  6. "actions": [
  7. {
  8. "reaction": "1",
  9. "varName": "msgReaction",
  10. "info": "0",
  11. "storage": "1",
  12. "varName2": "messageRct",
  13. "name": "Store Reaction Info"
  14. },
  15. {
  16. "behavior": "1",
  17. "interpretation": "1",
  18. "code": "const reaction = tempVars('msgReaction');\nconst msgRct = tempVars('messageRct');\nconst rectarray = globalVars('reactionRoleInf');\nvar usrWhoReacted = reaction.users.array();\nconst _this = this;\nvar messageSent = 'Successfully added the role {roleName} in {server}'; \n// The only variables that work rn, {rolename} and {server}\nvar actualUser;\n// Setings\n\nconst dmUserAfter = true; // Default, can be changed to false\n\n//\n\nasync function checkRoles() {\n\tfor (i = 0; i < rectarray.length; i++) {\n\t\tif (rectarray[i][msgRct.id] != null) {\n arrayNum = i;\n\t\t\tif (rectarray[i][msgRct.id][3] != null) {\n\t\t\t\tusrWhoReacted = rectarray[i][msgRct.id][3].filter(val => !usrWhoReacted.includes(val))[0];\n\t\t\t\tif (usrWhoReacted != null) {\n\t\t\t\t\tif (usrWhoReacted.data('cooldownData.reactionMenu') != 1) {\n\t\t\t\t\t\tvar newArr = rectarray[i][msgRct.id];\n\t\t\t\t\t\tfor (io = 0; io < newArr.length; io++) {\n\t\t\t\t\t\t\tif (newArr[io][0] == reaction.emoji.name) {\n\t\t\t\t\t\t\t\tvar newUsr = await msgRct.guild.fetchMember(usrWhoReacted);\n\t\t\t\t\t\t\t\tvar checkRole = await msgRct.guild.roles.get(newArr[io][1]);\n\t\t\t\t\t\t\t\tif (checkRole != null) {\n\t\t\t\t\t\t\t\t\tif (!newUsr.roles.has(newArr[io][1])) {\n usrWhoReacted.setData('cooldownData.reactionMenu', '1');\n var tempThing = globalVars('reactionRoleInf');\n\t\t\t\t\t\t\t\t\t tempThing[i][msgRct.id][3] = await reaction.users.array();\n _this.storeValue(tempThing, 3, 'reactionRoleInf', cache);\n interval = setInterval(resetTimer, 1000);\n\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\t} else {\n var tempThing = globalVars('reactionRoleInf');\n usrWhoReacted.setData('cooldownData.reactionMenu', '1');\n\t\t\t\t\t\t\t\t\t\ttempThing[i][msgRct.id][3] = await reaction.users.array();\n\t\t\t\t\t\t\t\t\t\t_this.storeValue(tempThing, 3, 'reactionRoleInf', cache)\n\t\t\t\t\t\t\t\t\t\tnewUsr.removeRole(newArr[io][1]);\n\t\t\t\t\t\t\t\t\t\tif (dmUserAfter) {\n\t\t\t\t\t\t\t\t\t\t\tmessageSent = messageSent.replace(/{roleName}/g, newArr[io][2]);\n messageSent = messageSent.replace(/{server}/g, msgRct.guild.name);\n\t\t\t\t\t\t\t\t\t\t newUsr.send(messageSent);\n }\n interval = setInterval(resetTimer, 1000);\n\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t} else {\n var newArray = rectarray.filter(someItem => {\n someItem.hasOwnProperty(msgRct.id) != true\n })\n _this.storeValue(newArray, 3, 'reactionRoleInf', cache);\n _this.storeValue(JSON.stringify(newArray), 3, 'tempData', cache);\n\t\t\t\t\t\t\t\t\tmsgRct.edit({\n\t\t\t\t\t\t\t\t\t\tembed: {\n\t\t\t\t\t\t\t\t\t\t\tcolor: 0xff0000,\n\t\t\t\t\t\t\t\t\t\t\ttitle: \"Role Reaction Menu\",\n\t\t\t\t\t\t\t\t\t\t\tdescription: `An error has occured.\\nOne of the roles, role name - ${newArr[io][2]} does not exist anymore.\\nIn turn, this embed has now shutdown.\\nPlease remake the embed.`,\n\t\t\t\t\t\t\t\t\t\t\ttimestamp: new Date()\n\t\t\t\t\t\t\t\t\t\t}\n });\n _this.callNextAction(cache);\n\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t} else {\n usrWhoReacted.setData('cooldownData.reactionMenu', '0');\n }\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n}\n\nfunction resetTimer() {\n usrWhoReacted.setData('cooldownData.reactionMenu', '0');\n clearInterval(interval);\n}\n\ncheckRoles();",
  19. "storage": "0",
  20. "varName": "",
  21. "name": "Run Script"
  22. },
  23. {
  24. "storage": "3",
  25. "varName": "tempData",
  26. "name": "Save Variable"
  27. }
  28. ]
  29. }
Add Comment
Please, Sign In to add comment