Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- {
- "name": "reactionRev",
- "temp": "msgReaction",
- "event-type": "29",
- "_id": "ZQmhC",
- "actions": [
- {
- "reaction": "1",
- "varName": "msgReaction",
- "info": "0",
- "storage": "1",
- "varName2": "messageRct",
- "name": "Store Reaction Info"
- },
- {
- "behavior": "1",
- "interpretation": "1",
- "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();",
- "storage": "0",
- "varName": "",
- "name": "Run Script"
- },
- {
- "storage": "3",
- "varName": "tempData",
- "name": "Save Variable"
- }
- ]
- }
Add Comment
Please, Sign In to add comment