-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbot.js
executable file
·242 lines (183 loc) · 6.52 KB
/
bot.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
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
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
// ________ ________ ________ ________ ___ ___ ________ ___ ___ _________
//|\ ____\|\ __ \|\ __ \|\_____ \ |\ \ / /|\ ____\\ \ |\ \|\___ ___\
//\ \ \___|\ \ \|\ \ \ \|\ \\|___/ /| \ \ \/ / | \ \___\ \ \\_\ \|___ \ \_|
// \ \ \ \ \ _ _\ \ __ \ / / / \ \ / / \ \ \ \ \______ \ \ \ \
// \ \ \____\ \ \\ \\ \ \ \ \ / /_/__ \/ / / \ \ \___\|_____|\ \ \ \ \
// \ \_______\ \__\\ _\\ \__\ \__\\________\__/ / / \ \_______\ \ \__\ \ \__\
// \|_______|\|__|\|__|\|__|\|__|\|_______|\___/ / \|_______| \|__| \|__|
// \|___|/
// --------------------------------saidneder.tech----------------------------------------
// ---------------Patrick Star Class notifier bot-----------------
// Docs = https://discordjs.guide/#before-you-begin
// ----------Logging into discord--------------
// require the discord.js and cron module
const Discord = require("discord.js");
const cron = require("cron");
// create a new Discord client
const client = new Discord.Client();
// remote config file where my data is stored
const { prefix, token, channelid, guildid } = require("./config.json");
// When client is ready, run this:
// This will only run one time after logging in
client.once("ready", () => {
console.log(`Online as ${client.user.tag}`);
client.user.setActivity("9help");
const kalamardo = client.guilds.cache.get(guildid);
const channel = kalamardo.channels.cache.get(channelid);
const idukay = "https://idukay.net/#/";
// ------------------------ Messages and cron jobs ------------------------------
// A cron job is a process that is going to execute something at a certain time.
// Docs: https://www.npmjs.com/package/cron
const notificationclass = `You have class! GO NOW ${idukay}`;
const classbreak = "You have a break right now, patience and be calm, enjoy!";
// send a message if it is the time specified.
let classnotification1 = new cron.CronJob("00 00 13 * * 1-5", () => {
channel.send(notificationclass);
});
let classnotification2 = new cron.CronJob("00 35 13 * * 1-5", () => {
channel.send(notificationclass);
});
let classnotification3 = new cron.CronJob("00 10 14 * * 1-5", () => {
channel.send(notificationclass);
});
let classnotification4 = new cron.CronJob("00 45 14 * * 1-5", () => {
channel.send(classbreak);
});
let classnotification5 = new cron.CronJob("00 00 15 * * 1-5", () => {
channel.send(notificationclass);
});
let classnotification6 = new cron.CronJob("00 35 15 * * 1-5", () => {
channel.send(notificationclass);
});
let classnotification7 = new cron.CronJob("00 10 16 * * 1-5", () => {
channel.send(notificationclass);
});
let classnotification8 = new cron.CronJob("00 45 16 * * 1-5", () => {
channel.send(classbreak);
});
let classnotification9 = new cron.CronJob("00 00 17 * * 1-5", () => {
channel.send(notificationclass);
});
let classnotification10 = new cron.CronJob("00 35 17 * * 1-5", () => {
channel.send(
`You have ended your classes for today! enjoy the rest of your day`
);
});
// When you want to start it, use:
classnotification1.start();
classnotification2.start();
classnotification3.start();
classnotification4.start();
classnotification5.start();
classnotification6.start();
classnotification7.start();
classnotification8.start();
classnotification9.start();
classnotification10.start();
});
// login to Discord with token
client.login(token);
// creating functions to return text that we will use to reply back
function help() {
return `
📌Commands to use patrick star:
9day =
Show the classes of the day📆
9mail =
It will reply with a gmail's link📫
9idukay =
It will reply with a Idukay Link!📝
9info =
Information about the project!🚀
`;
}
// Listening to messages if the client is on
client.on("message", (message) => {
//declaring variables
const friday = `
8:00 am -- English
8:35 am -- English
9.10 am -- PPE
9:45 am -- Receso
10:00 am -- PPE
10:35 am -- English
11:10 am -- English
11:45 AM -- Receso
12:00 am -- Matematica
`;
const thursday = `
8:00 am -- English
8:35 am -- English
9.10 am -- Quimica
9:45 AM -- Receso
10:00 am -- Historia
10:35 am -- Matematicas
11:10 am -- Biologia
11:45 AM -- Receso
12:00 am -- Lenguaje
`;
const wednesday = `
8:00 am -- Matematica
8:35 am -- Matematica
9.10 am -- Quimica
9:45 AM -- Receso
10:00 am -- Biologia
10:35 am -- English
11:10 am -- English
11:45 AM -- Receso
12:00 am -- Lenguaje
`;
const tuesday = `
8:00 am -- Fisica
8:35 am -- Historia
9.10 am -- English
9:45 AM -- Receso
10:00 am -- English
10:35 am -- Filosofia
11:10 am -- Orientacion Vocacional
11:45 AM -- Receso
12:00 am -- Lenguaje
`;
const monday = `
8:00 am -- Fisica
8:35 am -- Historia
9.10 am -- Emprendimiento
9:45 am -- Receso
10:00 am -- Emprendimiento
10:35 am -- Filosofia
11:10 am -- English
11:45 AM -- Receso
12:00 am -- Lenguaje
`;
var days = [monday, tuesday, wednesday, thursday, friday];
const date = new Date();
const today = date.getDay();
const hour = date.getHours().toString();
const minutes = date.getMinutes().toString();
const time = hour + minutes;
const gmail = "https://mail.google.com/mail/u/1/?ogbl#inbox";
const github = "https://github.com/crazyc4t";
const discordid = "DarthNeder#2142";
const idukay = "https://idukay.net/#/";
const webpage = "https://saidneder.tech/";
// Print every message in the server in the console
console.log(message.content, time);
// if one of the message is help do this:
if (message.content === `${prefix}help`) {
// reply in the same channel from it was sent
message.channel.send(help());
// you concatenate messages with the else if block
} else if (message.content === `${prefix}calendar`) {
message.channel.send(`There you go! ${calendar}`);
} else if (message.content === `${prefix}idukay`) {
message.channel.send(`Voila! ${idukay}`);
} else if (message.content === `${prefix}mail`) {
message.channel.send(`Sent! ${gmail}`);
} else if (message.content === `${prefix}day`) {
message.channel.send(`Today's scheadule: ${days[today - 1]}`);
} else if (message.content === `${prefix}info`) {
message.channel.send(
`This was made by Said Neder\nGithub: ${github}\nDiscord: ${discordid}\nWebpage: ${webpage}`
);
}
});