-
Notifications
You must be signed in to change notification settings - Fork 6
/
animeradioclub-nosql.js
298 lines (256 loc) · 9.86 KB
/
animeradioclub-nosql.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
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
const Discord = require("discord.js");
const client = new Discord.Client();
var config = require("./config.json");
const request = require("request");
const version = "5.2"
let listeners = 0;
client.on('ready', () => {
console.log("Anime Radio Club, rolling out!")
});
client.on("message", message => {
if (message.channel.type === 'dm') return;
if (message.channel.type !== 'text') return;
if (message.author.bot) return;
const prefix = ">";
const args = message.content.split(" ");
let command = args[0];
command = command.slice(prefix.length)
if (!message.content.startsWith(prefix)) return;
var reason1 = args.slice(1).join(" ");
if (command === "eval") {
if (message.author.id === config.owner) {
try {
var output = eval(args.slice(1).join(" "))
message.channel.send('**Output:** ' + output)
return
} catch (error) {
message.channel.send('**Error:** ```' + error + '```')
return
}
} else {
message.channel.send("I'm sorry, only the bot creator can use this command!")
}
}
if (command === "ping") {
message.channel.send("Ping?").then(message => {
message.edit(`Pong! - ${Math.round(client.ping)} ms`);
});
}
if (command === "restart") {
if (message.author.id === config.owner) {
message.channel.send(":wave: Rebooting!")
setTimeout(function() {
process.exit(1);
}, 3 * 1000)
} else {
message.channel.send("I'm sorry, only the bot creator can use this command!")
}
}
if (command === "updates") {
const embed = new Discord.MessageEmbed()
.setColor(3447003)
.setAuthor('Update Notes', client.user.avatarURL)
.addField(`What's new in Version ${version}:`, `- Updated invite link
- Removed commands that would target channels in the support server`)
.addField(`What was new in Previous Version:`, `- Removed Italian to see if it'll help the bot actually run
- Removed limit for requesting
- Updated Discord.js to v12 so was forced to update all code`)
message.channel.send(embed)
}
if (command === "donators") {
const embed = new Discord.MessageEmbed()
.setColor(3447003)
.setAuthor('Donators', client.user.avatarURL)
.setDescription("Buttons#3961 - $5")
.setFooter("Awesome list of people")
message.channel.send(embed)
}
if (command === "play") {
const voiceChannel = message.member.voice.channel;
if (!voiceChannel) {
const embed = new Discord.MessageEmbed()
.setColor("#ff0000")
.addField('Error!', "You must be in a Voice channel to use this command!")
message.channel.send(embed)
return
}
if (!args[1]) {
const embed = new Discord.MessageEmbed()
.setColor("#ff0000")
.addField('Error!', "No radio was selected!")
message.channel.send(embed)
return
}
if (args[1] === "1") {
const embed = new Discord.MessageEmbed()
.setColor("#68ca55")
.addField('Success!', "Now playing AnimeNexus in " + message.member.voice.channel)
message.channel.send(embed);
message.member.voice.channel.join().then(connection => {
require('http').get("http://radio.animenexus.mx:8000/animenexus", (res) => {
connection.play(res).on('error', err => {
client.logger.error(err);
connection.play(res)
})
})
})
return
}
const embed = new Discord.MessageEmbed()
.setColor("#ff0000")
.addField('Error!', "Radio does not exist!")
message.channel.send(embed)
}
if (command === "invite") {
const embed = new Discord.MessageEmbed()
.setColor(3447003)
.addField('Invite me to your server!', '[Click Here](https://discord.com/api/oauth2/authorize?client_id=868709887310434415&permissions=8&scope=bot)')
.addField('Get support!', '[Click Here](https://discord.gg/WCxHjFX)')
.setThumbnail(client.user.avatarURL)
message.channel.send(embed);
}
if (command === "website") {
const embed = new Discord.MessageEmbed()
.setColor(3447003)
.addField('View our Website!', '[Click Here](http://animeradioclub.com/)')
.addField('View our Source code on Github!', '[Click Here](https://github.com/lol123Xb/Anime-Radio-Club-Discord-Bot)')
.setThumbnail(client.user.avatarURL)
message.channel.send(embed);
}
if (command === "donate") {
const embed = new Discord.MessageEmbed()
.setColor(3447003)
.addField('Donate Paypal', '[Click Here](https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=6VT2S8CMDZH2L&lc=AU&item_name=AnimeRadioClub&item_number=arc¤cy_code=USD&bn=PP%2dDonationsBF%3abtn_donateCC_LG%2egif%3aNonHosted)', true)
.setThumbnail(client.user.avatarURL)
.setFooter("After donating, contact me directly, Felix#1330, to get yourself on the list of donators")
message.channel.send(embed);
}
if (command === "stats") {
const game = client.user.presence.game || {};
const embed = new Discord.MessageEmbed()
.setTitle('Anime Radio Club')
.setAuthor('Felix#1330', 'https://scontent.fper5-1.fna.fbcdn.net/v/t1.0-9/s960x960/73068604_2587656247939444_4950220292795400192_o.jpg')
.setColor(3447003)
.addField(':desktop: Servers', `${client.guilds.cache.size}`, true)
.addField(':thinking: RAM usage', `${(process.memoryUsage().heapUsed / 1024 / 1024).toFixed(2)} MB`, true)
.addField(':floppy_disk: Version', version, true)
.addField(`:musical_note: Listeners:`, `${listeners}`, true)
.setThumbnail(client.user.avatarURL)
message.channel.send(embed)
}
if (command === "list") {
const embed = new Discord.MessageEmbed()
.setColor(3447003)
.addField('Radio Station List:', '`1`: AnimeNexus\n')
.setFooter("Request a radio station to be added with the `request` command.")
.setThumbnail(client.user.avatarURL)
message.channel.send(embed)
}
if (command === "link") {
const voiceChannel = message.member.voice.channel;
if (!voiceChannel) {
const embed = new Discord.MessageEmbed()
.setColor("#ff0000")
.addField('Error!', "You must be in a Voice channel to use this command!")
message.channel.send(embed)
return
}
if (!args[1]) {
const embed = new Discord.MessageEmbed()
.setColor("#ff0000")
.addField('Error!', "No URL inputted!")
message.channel.send(embed)
return
}
if (message.content.match(/http/i)) {
const embed = new Discord.MessageEmbed()
.setColor("#68ca55")
.addField('Success!', "Now playing your inputted radio station in " + message.member.voice.channel + "\nIf you can't hear anything after a while it could be because the link was invalid")
message.channel.send(embed);
const member1 = message.guild.member(client.user);
message.member.voice.channel.join().then(connection => {
require('http').get(args[1], (res) => {
connection.play(res);
})
return
}
const embed = new Discord.MessageEmbed()
.setColor("#ff0000")
.addField('Error!', "Inputted URL did not contain http at the start!")
message.channel.send(embed)
return
}
if (command === "leave") {
if (message.member.voice.channel) {
const embed = new Discord.MessageEmbed()
.setColor("#68ca55")
.addField('Success!', "Voice channel successfully left!")
message.channel.send(embed);
message.member.voice.channel.leave();
return
} else {
const embed = new Discord.MessageEmbed()
.setColor("#ff0000")
.addField('Error!', "You are currently not in a voice channel!")
message.channel.send(embed)
return
}
}
if (command === "help") {
if (args[1] === null || args[1] === "") {
const embed = new Discord.MessageEmbed()
.setColor(3447003)
.addField('Help Categories:', '`1.` Music Commands\n\
`2.` Miscellaneous\n\
`3.` Support Commands\n\
Do `help <number>` to select a category')
.setThumbnail(client.user.avatarURL)
message.channel.send(embed)
return
}
if (args[1] === "1") {
const page1 = new Discord.MessageEmbed()
.setColor(3447003)
.setTitle("Music Commands")
.setDescription('`play <radio number>`: Plays a radio station.\n\
`link <radio url>`: Plays the radio station through its url, link must be http and something like "<http://88.198.69.145:8722/stream>"\n\
`leave`: Make the bot leave the channel.\n\
`list`: Lists the possible radio stations to be played.\n')
message.channel.send(page1)
return
}
if (args[1] === "2") {
const page2 = new Discord.MessageEmbed()
.setColor(3447003)
.setTitle("Miscellaneous")
.setDescription('`help`: Displays all help categories.\n\
`donate`: Grab the donate link.\n\
`donators`: Sends a list of people who helped support Anime Radio Club through donations.\n\
`ping`: Pong!\n\
`stats`: Check Anime Radio Club\'s stats.\n\
`setprefix`: Set the prefix for your guild.\n\
`restart`: Restart the bot (Only for bot owner).\n')
message.channel.send(page2)
return
}
if (args[1] === "3") {
const page3 = new Discord.MessageEmbed()
.setColor(3447003)
.setTitle("Support Commands")
.setDescription('`invite`: Grab the invite links for the bot.\n\
`website`: Grab the website and github link for the bot.\n\
`updates`: Displays the update notes so you know what\'s new in this version of the bot.')
message.channel.send(page3)
return
}
const embed = new Discord.MessageEmbed()
.setColor(3447003)
.addField('Help Categories:', '`1.` Music Commands\n\
`2.` Miscellaneous\n\
`3.` Support Commands\n\
Do `help <number>` to select a category')
.setThumbnail(client.user.avatarURL)
message.channel.send(embed)
}
});
client.login(config.token);