-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbot.js
More file actions
150 lines (149 loc) · 5.63 KB
/
bot.js
File metadata and controls
150 lines (149 loc) · 5.63 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
const Discord = require('discord.js')
const client = new Discord.Client();
const config = require("./config.json");
client.on("ready", ()=> {
console.log("Starting up the bot.")
console.log("-----------------------")
console.log(`${client.user.username} is ready! ID: ${client.user.id}.`)
client.user.setActivity(`on Discord | &help`, { type: `PLAYING` });
})
client.on("message", async message => {
if(message.content.startsWith("&ping")) {
const m = await message.channel.send({embed: {
"color": 3447003,
"fields": [{
"name": `:clock330: Pong!`,
"value": `Awaiting response from the Discord API...`,
}
],
"timestamp": new Date(),
"footer": {
"icon_url": client.user.avatarURL,
"text": `Command executed by ${message.author.username}`
}
}
});
m.edit({embed: {
"color": 3447003,
"fields": [{
"name": `:clock330: Pong!`,
"value": `Client latency is ${m.createdTimestamp - message.createdTimestamp}ms. API latency is ${client.ping}ms.`,
}
],
"timestamp": new Date(),
"footer": {
"icon_url": client.user.avatarURL,
"text": `Command executed by ${message.author.username}`
}
}
});
}
if(message.content.startsWith("&help")) {
message.channel.send({embed: {
"color": 3447003,
"fields": [{
"name": `:pencil: Commands List`,
"value": "help = Prints this help message.\nping = Pings the client and API to fetch the current latency.\ncode = Links the bot's GitHub repository.\ninfo **[WIP]** = Lists information about the bot, including build info, version and more.",
},
],
"timestamp": new Date(),
"footer": {
"icon_url": client.user.avatarURL,
"text": `Command executed by ${message.author.username}`
}
}
});
}
const swearWords = ["darn", "asshole", "fuck", "shit", "kys", "cunt", "nigger", "nigga", "tecistesting"];
if (swearWords.some(word => message.content.includes(word)) ) {
message.channel.send({"embed": {
"color": 3447003,
"timestamp": new Date(),
"footer": {
"icon_url": client.user.avatarURL,
"text": ``
},
"fields": [
{"name": `:x: Swearing is not allowed, ${message.author.username}!`,
"value": "Please do not say `" + message.content + "`."}]}});
const staff = message.guild.roles.find("name", "Staff");
message.channel.send(`[<@&${staff.id}> Notification] **${message.author}** broke **Rule #4**: Swearing. Please perform the following command to log the offense: ?warn ${message.author} Swearing`)
}
if(message.content.startsWith("&code")) {
message.channel.send({embed: {
"color": 3447003,
"fields": [{
"name": `:computer: GitHub Repository`,
"value": "You can follow along with the development in real-time by visiting the GitHub repository for the project here: https://github.com/theeighthcow/BackchatterBot",
},
],
"timestamp": new Date(),
"footer": {
"icon_url": client.user.avatarURL,
"text": `Command executed by ${message.author.username}`
}
}
});
}
if(message.content.startsWith("&welcomemsg")) {
message.delete()
message.channel.send({embed: {
"color": 3447003,
"fields": [{
"name": `:wave: Hello!`,
"value": "Hi there! I'm Backchatter, a private bot for the BackChat server! ",
},
],
"timestamp": new Date(),
"footer": {
"icon_url": client.user.avatarURL,
"text": `Command executed by ${message.author.username}`
}
}
});
}
if(message.content.startsWith("&inviteme")) {
message.channel.send({embed: {
"color": 3447003,
"fields": [{
"name": `:airplane: OAuth2 Link [Dev Only]`,
"value": "This link may only be used by the developer of the bot. If you have adaquate permissions, go to https://discordapp.com/api/oauth2/authorize?client_id=414824583355432972&permissions=8&scope=bot.",
},
],
"timestamp": new Date(),
"footer": {
"icon_url": client.user.avatarURL,
"text": `Command executed by ${message.author.username}`
}
}
});
}
if(message.content.startsWith("&info")) {
message.channel.send({embed: {
"color": 3447003,
"fields": [{
"name": `:desktop: Version`,
"value": `Version 1.2`,
"inline": true
},
{
"name": `:person_with_blond_hair: Developer`,
"value": `TheEighthCow#1584`,
"inline": true
},
{
"name": `:arrows_counterclockwise: Status`,
"value": `Private`,
"inline": true
},
],
"timestamp": new Date(),
"footer": {
"icon_url": client.user.avatarURL,
"text": `Command executed by ${message.author.username}`
}
}
});
}
})
client.login(config.token)