-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.js
67 lines (51 loc) · 2.17 KB
/
main.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
'use strict';
// Import the discord.js module
const Discord = require('discord.js');
// Create an instance of a Discord client
const client = new Discord.Client();
var responseMessage
// Bot ready
client.once('ready', () => {
console.log(`Bot ready`);
});
// Bot on message
client.on('message', message => {
// Converting message to lower case
var msgLowerCase = message.content.toLowerCase();
// I love you thing
const iLoveYou = msgLowerCase.includes("i") && msgLowerCase.includes("love") || msgLowerCase.includes("luv") && msgLowerCase.includes("you") || msgLowerCase.includes("u");
if(iLoveYou && msgLowerCase.includes("botNameHere")) {
if(message.author.bot) return;
console.log(`Message "${message.content}" sent by ${message.author.tag} in server "${message.guild}" on #${message.channel.name}`);
responseMessage = `I love you too, ${message.author}.`
message.channel.send(responseMessage);
console.log(`Responded to message with "${responseMessage}"`);
}
if(iLoveYou && message.channel.type === 'dm') {
if(message.author.bot) return;
console.log(`Direct message received`);
responseMessage = `I love you too`;
message.channel.send(responseMessage);
console.log(`Responded to direct message`);
}
// Morning
const morning = msgLowerCase.includes("gm") || msgLowerCase.includes("morning");
if(morning && message.channel.type === 'dm') {
if(message.author.bot) return;
console.log(`Direct message received`);
responseMessage = `Good morning`;
message.channel.send(responseMessage);
console.log(`Responded to direct message`);
}
// Night
const night = msgLowerCase.includes("gn") || msgLowerCase.includes("night");
if(night && message.channel.type === 'dm') {
if(message.author.bot) return;
console.log(`Direct message received`);
responseMessage = `Good night`;
message.channel.send(responseMessage);
console.log(`Responded to direct message`);
}
});
// Login token, do not leak to anyone and keep is on the lowest line all the time
client.login('tokenHere');