-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.js
More file actions
194 lines (173 loc) Β· 8.48 KB
/
Copy pathapp.js
File metadata and controls
194 lines (173 loc) Β· 8.48 KB
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
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
const Discord = require('discord.js');
const CronJob = require('cron').CronJob;
require('dotenv').config();
const announcement = "868640718791536700";
const client = new Discord.Client({
partials: ['MESSAGE', 'REACTION', 'CHANNEL'],
});
client.login(process.env.BOT_TOKEN);
client.on('ready', () => {
// activity status
client.user.setActivity('bit.ly/compscilinktree', { type: 'LISTENING' });
// new member
client.on('guildMemberAdd', member => {
client.channels.cache.get("868644512757604372").send(`Welcome ${member}, check out <#868640851578998845>, <#752336985250725888>, <#868641180559233064>, and change your nickname to your real name!`);
member.roles.add("752342157200719894");
member.roles.add("752677539243098224");
});
client.on('guildMemberRemove', member => {
// client.channels.cache.get("754527701573959790").send(`${member} dipped`);
});
// Adding reaction-role function
client.on('messageReactionAdd', async (reaction, user) => {
if (reaction.message.partial) await reaction.message.fetch();
if (reaction.partial) await reaction.fetch();
if (user.bot) return;
if (!reaction.message.guild) return;
if (reaction.message.channel.id == '868641180559233064') {
if (reaction.emoji.name === 'π¦') {
await reaction.message.guild.members.cache
.get(user.id)
.roles.add('752606031988785192');
}
if (reaction.emoji.name === '1οΈβ£') {
await reaction.message.guild.members.cache
.get(user.id)
.roles.add('753687984091693067');
}
if (reaction.emoji.name === '2οΈβ£') {
await reaction.message.guild.members.cache
.get(user.id)
.roles.add('753688089959989259');
}
if (reaction.emoji.name === '3οΈβ£') {
await reaction.message.guild.members.cache
.get(user.id)
.roles.add('753688141252001812');
}
if (reaction.emoji.name === 'π·') {
await reaction.message.guild.members.cache
.get(user.id)
.roles.add('764607752554938378');
}
if (reaction.emoji.name === 'π') {
await reaction.message.guild.members.cache
.get(user.id)
.roles.add('771150360425398302');
}
if (reaction.emoji.name === 'π') {
await reaction.message.guild.members.cache
.get(user.id)
.roles.add('771150352107044865');
}
if (reaction.emoji.name === 'π') {
await reaction.message.guild.members.cache
.get(user.id)
.roles.add('771150354166710292');
}
if (reaction.emoji.name === 'π') {
await reaction.message.guild.members.cache
.get(user.id)
.roles.add('771150358164668436');
}
if (reaction.emoji.name === 'π§ ') {
await reaction.message.guild.members.cache
.get(user.id)
.roles.add('791333902123139143');
}
} else return;
});
// Removing reaction roles
client.on('messageReactionRemove', async (reaction, user) => {
if (reaction.message.partial) await reaction.message.fetch();
if (reaction.partial) await reaction.fetch();
if (user.bot) return;
if (!reaction.message.guild) return;
if (reaction.message.channel.id == '868641180559233064') {
if (reaction.emoji.name === 'π¦') {
await reaction.message.guild.members.cache
.get(user.id)
.roles.remove('752606031988785192');
}
if (reaction.emoji.name === '1οΈβ£') {
await reaction.message.guild.members.cache
.get(user.id)
.roles.remove('753687984091693067');
}
if (reaction.emoji.name === '2οΈβ£') {
await reaction.message.guild.members.cache
.get(user.id)
.roles.remove('753688089959989259');
}
if (reaction.emoji.name === '3οΈβ£') {
await reaction.message.guild.members.cache
.get(user.id)
.roles.remove('753688141252001812');
}
if (reaction.emoji.name === 'π·') {
await reaction.message.guild.members.cache
.get(user.id)
.roles.remove('764607752554938378');
}
if (reaction.emoji.name === 'π') {
await reaction.message.guild.members.cache
.get(user.id)
.roles.remove('771150360425398302');
}
if (reaction.emoji.name === 'π') {
await reaction.message.guild.members.cache
.get(user.id)
.roles.remove('771150352107044865');
}
if (reaction.emoji.name === 'π') {
await reaction.message.guild.members.cache
.get(user.id)
.roles.remove('771150354166710292');
}
if (reaction.emoji.name === 'π') {
await reaction.message.guild.members.cache
.get(user.id)
.roles.remove('771150358164668436');
}
if (reaction.emoji.name === 'π§ ') {
await reaction.message.guild.members.cache
.get(user.id)
.roles.remove('791333902123139143');
}
} else return;
});
// var tue330 = new CronJob(
// '0 5 23 * * 1',
// function(){
// // client.channels.cache.get(announcement).send(`Hello <@&752342157200719894>,\n\nMeeting at lunch (12:35) tomorrow! We will be going over the past 2021 US Open then finishing our Rock Paper Scissor Competition.\n\nZoom Link: https://bit.ly/whscompscizoom\nPassword: **compsci**\n\nSee you there!`);
// client.channels.cache.get(announcement).send(`<@&752342157200719894> Meeting today at lunch! (if you missed our email, we're switching to Tues instead of Thurs)`);
// },
// null,
// true,
// 'America/Los_Angeles'
// );
var wed1230 = new CronJob(
'0 0 6 * * 2',
function(){
// client.channels.cache.get(announcement).send(`<@&752342157200719894> We're going to be moving our Tue lunch meetings -> **zoom at Sunday 7pm** starting this week! Look out for the link on Sunday`);
// client.channels.cache.get(announcement).send(`Hi @everyone! **Wear dark colors today and go to the Peforming Arts Center at the start of lunch for club pictures!**`);
},
null,
true,
'America/Los_Angeles'
);
var sun = new CronJob(
'0 45 11 * * 2', // 0 0 19 * * 0
function(){
client.channels.cache.get(announcement).send(`Hi @everyone! **Meeting today** in Room F1 (Mr. Blackford). See you there!!! Time to advent some code :D`);
},
null,
true,
'America/Los_Angeles'
);
// client.channels.cache.get("752334786260893697").send(`Our first meeting will be during Lunch tomorrow (Thursday 9/9) in room F1 (Blackford). See you there!`)
// USACO start
// client.channels.cache.get(announcement).send(`**<@&791333902123139143> returns on Friday! (TOMORROW)**: last comp of this *season*\n\nThe 2021 USACO Open contest will begin this Friday. Competitors will have **five hours** to solve three problems; high scorers will receive promotions to the next division, with perfect scorers being promoted in-contest and earning the right to take the next division's contest within the Open competition period. More info here: <http://usaco.org>\n\nAs a reminder, **no discussion** of the problems or the contest is allowed.\n\n<#752339796340244602> has been locked\n\nIf you have questions about the contest, contact the organizers at the email address listed on the website in the contest rules or message an officer.\n\nBest of Luck!!! :cow:`);
// USACO channel closure message
// client.channels.cache.get("752339796340244602").send(`:lock:`);
});