-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmassAssignRole.js
149 lines (134 loc) · 4.72 KB
/
massAssignRole.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
const DiscordJS = require('discord.js');
const {Intents} = require('discord.js');
require('dotenv').config();
const testServerId = "897146233238478929";
const chainShotServerId = "571015837163454489";
const client = new DiscordJS.Client({
// provide intents
intents: [
Intents.FLAGS.GUILDS,
Intents.FLAGS.GUILD_MESSAGES,
Intents.FLAGS.GUILD_MEMBERS,
Intents.FLAGS.GUILD_PRESENCES
]
});
const shard1 = {
"853376156861595658": {chainShotId: "6148d8c79473e7000434c99e"}, // 1 - 4 are the AE peeps
"668037938495488000": {chainShotId: "6148d8c79473e7000434c99e"},
"654445385330327554": {chainShotId: "6148d8c79473e7000434c99e"},
"356153433734119424": {chainShotId: "6148d8c79473e7000434c99e"},
"715746773561245809": {chainShotId: "6148d8c79473e7000434c99e"},
"456937348941479937": {chainShotId: "6148d8c79473e7000434c99e"},
"890395309291745301": {chainShotId: "6148d8c79473e7000434c99e"},
"437110790877741056": {chainShotId: "6148d8c79473e7000434c99e"},
"578632707177971735": {chainShotId: "6148d8c79473e7000434c99e"},
"291015579945664512": {chainShotId: "6148d8c79473e7000434c99e"},
"731173053286973540": {chainShotId: "6148d8c79473e7000434c99e"},
"704784847209758810": {chainShotId: "6148d8c79473e7000434c99e"},
"656861379348922378": {chainShotId: "6148d8c79473e7000434c99e"},
"800440264527183905": {chainShotId: "6148d8c79473e7000434c99e"},
"204214795606425600": {chainShotId: "6148d8c79473e7000434c99e"},
"818235028211236866": {chainShotId: "6148d8c79473e7000434c99e"},
"733626849162297354": {chainShotId: "6148d8c79473e7000434c99e"},
"892425930906165318": {chainShotId: "6148d8c79473e7000434c99e"},
"886530957765664798": {chainShotId: "6148d8c79473e7000434c99e"},
"850444312596185089": {chainShotId: "6148d8c79473e7000434c99e"},
"821007707615395860": {chainShotId: "6148d8c79473e7000434c99e"},
"736657539164405833": {chainShotId: "6148d8c79473e7000434c99e"},
"780117870943928360": {chainShotId: "6148d8c79473e7000434c99e"},
"543367194344685579": {chainShotId: "6148d8c79473e7000434c99e"},
"811775952522706944": {chainShotId: "6148d8c79473e7000434c99e"}
}
const shard1Array = [
"853376156861595658", // 1 - 4 are the AE peeps
"668037938495488000",
"654445385330327554",
"356153433734119424",
"715746773561245809",
"456937348941479937",
"890395309291745301",
"437110790877741056",
"578632707177971735",
"291015579945664512",
"731173053286973540",
"704784847209758810",
"656861379348922378",
"800440264527183905",
"204214795606425600",
"818235028211236866",
"733626849162297354",
"892425930906165318",
"886530957765664798",
"850444312596185089",
"821007707615395860",
"736657539164405833",
"780117870943928360",
"543367194344685579",
"811775952522706944"
]
const shard1_roles = [
"893250314361245747", // shard 1 rollup 1
"894596512502411326", // shard 1 rollup 2
"894596706694483980", // shard 1 rollup 3
"894596756342448149", // shard 1 rollup 4
"894596819038900254" // shard 1 rollup 5
]
const bootcampRoleId = "705171010315354163";
client.login(process.env.DISCORD_BOT_TOKEN).then(async () => {
const guild = client.guilds.cache.get(chainShotServerId);
let members = await guild.members.fetch();
let numberOfGroups = 4;
let sizeOfEachGroup = 4;
const groupsArray = [[
// This group would like to stay together from here on out
'853376156861595658',
'824673339750219836',
'654445385330327554',
'356153433734119424',
],[
'736657539164405833',
'656861379348922378',
'850444312596185089',
'818235028211236866',
'780117870943928360'
],[
'800440264527183905',
'204214795606425600',
'731173053286973540',
'890395309291745301',
'715746773561245809'
],[
'892425930906165318',
'811775952522706944',
'886530957765664798',
'578632707177971735',
'291015579945664512'
],[
'733626849162297354',
'543367194344685579',
'456937348941479937',
'704784847209758810',
'821007707615395860',
'437110790877741056'
]];
// front-end UI -> user click on a button and gets assigned role
// brand new task ^
for(let i = 0; i < shard1_roles.length; i++) {
for(let j = 0; j < groupsArray.length; j++) {
for(let z = 0; z < groupsArray[j].length; z++) {
try {
if(shard1[groupsArray[j][z]]) {
// set the bootcamp role + relevant rollup role
let memberToEdit = members.find(member => member.id === groupsArray[j][z]);
console.log(memberToEdit + " get the role: " + shard1_roles[i]);
// uncomment line below to enact role change!
//memberToEdit.roles.set(["705171010315354163", shard1_roles[i]]);
}
} catch (err) {
console.log(err);
}
}
break;
}
}
});