· 8 years ago · Aug 01, 2018, 03:14 PM
1const Discord = require('discord.js');
2const robloxBOT = new Discord.Client();
3const config = require("./config.json");
4const prefix = ">"
5const staffPrefix = "!!"
6var fs = require('fs')
7const snekfetch = require('snekfetch');
8const sql = require("sqlite");
9sql.open("./verificationDatabase.sqlite");
10var rbx = require('roblox-js');
11var jar = rbx.options.jar;
12var options = {
13 username: 'TempleHIPPIE1Bot',
14 password: 'TP1H~Chris'
15}
16rbx.login(options)
17
18const verificationCode = ['apple','food','yum','pizza','raindrop','snow','birthday','cake','burger','soda','ice','no','yes','orange','pear','plum'];
19var Trello = require("trello");
20var trello = new Trello("f08889e495fdfa08a37d3df226b17cb5", "277f7788dffafa6d6dc6d9b94a1b12dd7300d8a39e1d3567de43b51c50939ef0");
21var cleverbot = require("cleverbot.io"),
22cleverBotbot = new cleverbot('1xrbcocZtW917Gir','ycsxR3FHJxcOoLNv89T4lVF5iptjpPMh');
23cleverBotbot.setNick("robloxBot | Discord");
24
25robloxBOT.on('ready', () => {
26 console.log('Turned on the Discord client.');
27 console.log('Running on guilds now...')
28 setInterval(() => {
29
30 }, 100000);
31 });
32 })
33
34robloxBOT.on('message', async message => {
35 console.log(`${message.guild.name} - ${message.guild.memberCount} users || Channel ID - ${message.channel.id}`)
36
37 // CONSTANTS [START]
38 const args = message.content.split(/[ ]+/) // TO SPLIT FROM THE STARTER ARGUMENT
39 const requestLogs = robloxBOT.channels.get('473828115823722496') // requests channel
40 const botCommander = message.guild.roles.find("name", "Bot Commander");
41 const robloxBOTPARTNERS = ['310800962723905548']
42 const kickMember = message.guild.member(message.mentions.users.first());
43 const banMember = message.guild.member(message.mentions.users.first());
44 const warnMember = message.guild.member(message.mentions.users.first());
45 const newBotCommander = message.guild.member(message.mentions.users.first());
46 const robloxBOTLOGS = robloxBOT.channels.get('473828115823722496')
47 // CONSTANTS [END]
48
49 // SQLITE TABLES [START]
50 sql.get(`SELECT * FROM scores WHERE userId ="${message.author.id}"`).then(row => { // ROBLOX-DISCORD VERIFICATION
51 if (!row) {
52 //sql.run("INSERT INTO scores (userId, robloxUsername) VALUES (?, ?)", [message.author.id, "-"]);
53 } else {
54 //console.log('nope!2')
55 //sql.run(`UPDATE scores SET points = ${row.points + 1} WHERE userId = ${message.author.id}`);
56 }
57 }).catch(() => {
58 console.error;
59 sql.run("CREATE TABLE IF NOT EXISTS scores (userId TEXT, robloxUsername TEXT)").then(() => {
60 sql.run("INSERT INTO scores (userId, robloxUsername) VALUES (?, ?)", [message.author.id, "-"]);
61 });
62 });
63
64 sql.get(`SELECT * FROM groupBind WHERE guildID = "${message.guild.id}"`).then(row => { // GROUP BIND PROCESS
65 if (!row) {
66 sql.run("INSERT INTO groupBind (guildID, groupID) VALUES (?, ?)", [message.guild.id, 0]);
67 } else {
68 // nothing
69 }
70 }).catch(() => {
71 console.error;
72 sql.run("CREATE TABLE IF NOT EXISTS groupBind (guildID TEXT, groupID INTEGER)").then(() => {
73 sql.run("INSERT INTO groupBind (guildID, groupID) VALUES (?, ?)", [message.guild.id, 0]);
74 });
75 });
76
77 sql.get(`SELECT * FROM blackList WHERE userId ="${message.author.id}"`).then(row => { // BLACKLIST STATUS
78 if (!row) {
79 sql.run("INSERT INTO blackList (userId, blacklistStatus) VALUES (?, ?)", [message.author.id, 0]);
80 } else {
81 //
82 }
83 }).catch(() => {
84 console.error;
85 sql.run("CREATE TABLE IF NOT EXISTS blackList (userId TEXT, blacklistStatus INTEGER)").then(() => {
86 sql.run("INSERT INTO blackList (userId, blacklistStatus) VALUES (?, ?)", [message.author.id, 0]);
87 });
88 });
89
90 sql.get(`SELECT * FROM staffTable WHERE userId ="${message.author.id}"`).then(row => { // STAFF STATUS
91 if (!row) {
92 //
93 } else {
94 //
95 }
96 }).catch(() => {
97 console.error;
98 sql.run("CREATE TABLE IF NOT EXISTS staffTable (userId TEXT, staffStatus INTEGER)").then(() => {
99 sql.run("INSERT INTO staffTable (userId, staffStatus) VALUES (?, ?)", [message.author.id, 0]);
100 });
101 });
102
103 sql.get(`SELECT * FROM prefixStatus WHERE guildID = "${message.guild.id}"`).then(row => { // PREFIX STATUS
104 if (!row) {
105 sql.run("INSERT INTO prefixStatus (guildID, prefix) VALUES (?, ?)", [message.guild.id, 0]);
106 } else {
107 // nothing
108 }
109 }).catch(() => {
110 console.error;
111 sql.run("CREATE TABLE IF NOT EXISTS prefixStatus (guildID TEXT, prefix TEXT)").then(() => {
112 sql.run("INSERT INTO prefixStatus (guildID, prefix) VALUES (?, ?)", [message.guild.id, ">"]);
113 });
114 });
115
116 // SQLITE TABLES [END]
117
118 const rowBlackListList = await sql.get(`SELECT * FROM blackList WHERE userId ="${message.author.id}"`);
119 const staffStatusList = await sql.get(`SELECT * FROM staffTable WHERE userId ="${message.author.id}"`);
120 const prefixStatusList = await sql.get(`SELECT * FROM prefixStatus WHERE guildID ="${message.guild.id}"`);
121
122 if (message.author.bot) return;
123 if (message.channel.id === '431212619278581771' && message.gulid.id === '430773300936048640') return;// anti chat in general
124 if (message.channel.id === '431213035005149186' && message.gulid.id === '430773300936048640') return;// anti chat in support
125 if (message.author.robloxBOT) return; // PREVENTS BOT FROM CHATTING WITH ITSELF
126 if (message.channel.type === "dm") return; // STOPS REACTIONS IN DMS
127 if (rowBlackListList.blacklistStatus === 1){ // BLACKLIST CHECK
128 return message.channel.send(`${message.author}, you're blacklisted from using this bot.\n\nIf you wish to appeal your blacklist, please contact the chairman. `).then(message => message.delete(10000));
129 }
130
131 // NORMAL USER COMMANDS [START]
132 if (message.content.startsWith(prefix + "info")){
133 const embed = new Discord.RichEmbed()
134 .setColor(0x4b7eff)
135 .setTitle("__Information__")
136 .setThumbnail("http://t6.rbxcdn.com/4d6bc095d7da7a299a7de5781ead44d8")
137 .addField("Commands", `To view all of the commands, run **>commands**.`)
138 .addField("Statistics", `To view the statistics, run **>stats**.`, true)
139 .addField("Website", "Click [here](https://www.roblox.com) to visit ROBLOX's official website.")
140 .addField("Support", "Is there an issue that you're encountering? Tell it to the chairman. The chairman is able to contact the developer or giving support. ", true)
141 .addField("Declaration", "This Discord client **does not** have any affiliation with the actual ROBLOX corporation. In no form is this client trying to slander the corporation or abuse its name in any shape or form.\n\nThis bot is merely to serve a purpose of ease to users of ROBLOX.")
142 return message.channel.send({embed}).then(message => message.delete(120000))
143 }
144
145 if (message.content.startsWith(prefix + "commands")){
146 message.author.send(`${message.author}, please note...\n\nThe following commands have the preset prefix declared here, that doesn't mean the guild you're currently in uses the same prefix. To find out what your client's prefix is, run **<@430775188448083988> prefix**.`)
147 const first = new Discord.RichEmbed()
148 .setColor(0xe94f4f)
149 .setThumbnail("http://t6.rbxcdn.com/4d6bc095d7da7a299a7de5781ead44d8")
150 .setDescription("**General**")
151 .addField(">commands", "Displays all of the commands a user can run.")
152 .addField(">stats", "Displays all of this client's statistics.")
153 .addField(">support", "Displays a direct link for users to join this client's official Discord guild.")
154 .addField("@ROBLOX help", "The bot will respond with the proper help you need to get the ball rolling.")
155 .addField(">request", "*This is for the chairman from Aiezo. The developer will check this and will help you further. *")
156 message.author.send({embed: first});
157 const second = new Discord.RichEmbed()
158 .setColor(0x6aaaff)
159 .setThumbnail("https://png.icons8.com/nolan/40/000000/error.png")
160 .setDescription("**ROBLOX**")
161 .addField(">verify [robloxUsername]", "Links ROBLOX account with Discord account\n**Stores into database for future reference**")
162 .addField(">unverify", "Unlinks the current linked ROBLOX account with Discord account\n")
163 .addField(">whois @mention OR [username]", "Displays information about the user mentioned or the given username.")
164 .addField(">groupinfo [ID]", "Displays information about a group given it's group ID.")
165 .addField(">groupBind [groupID]", "Binds group with the given group ID.")
166 .addField(">unbindGroup", "Unbinds group from the guild.")
167 .addField(">getRoles", "Adds the proper role to the user.")
168 message.author.send({embed: second});
169 const third = new Discord.RichEmbed()
170 .setColor(0xd64242)
171 .setThumbnail("https://png.icons8.com/nolan/40/000000/crown.png")
172 .setDescription("**Moderation**")
173 .addField(">kick @mention", "Kicks the user from the guild.")
174 .addField(">ban @mention", "Bans the user from the guild.")
175 .addField(">warn @mention [msg]", "Sends a direct message to the target (mentioned user) with the content of [msg].")
176 .addField(">prune [#]", "Prunes a number of messages where the number is [#].")
177 .addField(">bc @mention", "Adds the role `Bot Commander` to the mentioned user.")
178 message.author.send({embed: second2});
179 const staff = new Discord.RichEmbed()
180 .setColor(0x3e6178)
181 .setThumbnail("https://png.icons8.com/nolan/40/000000/employee-card.png")
182 .setDescription("**Staff**")
183 .addField("!!staffVerification", "Verifies that the user is a staff member for the ROBLOX Discord bot.")
184 .addField("!!leaveGuild", "Forces the bot to leave the guild where the message is ran.")
185 .addField("!!blacklist @mention", "Blacklists user from using the bot's commands.")
186 .addField("!!unblacklist @mention", "Unblacklists user from using the bot's commands.")
187 .addField("!!reload", "Stops all processes and restarts the bot.")
188 message.author.send({embed: staff});
189 const finalHelpNotice = new Discord.RichEmbed()
190 .setColor(0xffffff)
191 .setThumbnail("https://png.icons8.com/nolan/40/000000/help.png")
192 .setDescription("GENERAL NOTICE")
193 .addField("General Help", "If you still need help with whatever the issue is, please don't be afraid to contact the chairman.")
194 return message.author.send({embed: finalHelpNotice}).catch(console.error);
195 }
196
197
198
199 if (message.content.startsWith(prefix + "verify")){
200 let verifiedRole = message.guild.roles.find("name", "Verified");
201 if (!message.guild.members.get(robloxBOT.user.id).hasPermission("MANAGE_NICKNAMES")){
202 return message.channel.send("**Hey!\nI can't continue because someone forgot to give me the permission to manage nicknames!**").then(message => message.delete(30000))
203 }
204 if (!message.guild.members.get(robloxBOT.user.id).hasPermission("CHANGE_NICKNAME")){
205 return message.channel.send("**Hey!\nI can't continue because someone forgot to give me the permission to change nicknames!**").then(message => message.delete(30000))
206 }
207 if (!verifiedRole){
208 return message.channel.send("**Hey!\nI can't continue because someone forgot to add the `Verified` role to this server!**").then(message => message.delete(30000));
209 }
210 if (message.member.roles.exists('name', 'Verified')) {
211 const embed = new Discord.RichEmbed()
212 .setColor(0x28cd83)
213 .addField('Verification Process', "You've already been verified in this server, silly!")
214 return message.reply({ embed }).then(message => message.delete(30000));
215 }
216 const row = await sql.get(`SELECT * FROM scores WHERE userId ="${message.author.id}"`);
217 if (row){
218 message.channel.send(`Updating...`).then(message => message.delete(500))
219 message.channel.send(`Done! Welcome back, ${row.robloxUsername}! `).then(message => message.delete(5000));
220 message.member.addRole(message.guild.roles.find('name', 'Verified')).catch(console.error);
221 message.member.setNickname(row.robloxUsername);
222 return undefined;
223 }
224 if (!args[1]){
225 return message.channel.send(`**Hey!\nYou need to provide your username!**\n\nExample - **>verify ROBLOX**`).then(message => message.delete(30000))
226 }
227 var { body } = await snekfetch.get("https://api.rprxy.xyz/users/get-by-username?username=" + args[1])
228 if (body.errorMessage === "User not found"){
229 return message.channel.send("**Invalid ROBLOX username**\nPlease provide me with a **real** username. :rolling_eyes: ").then(message => message.delete(10000))
230 }
231 message.channel.send(`Successfully passed through fail checks!`).then(message => message.delete(1000));
232 var numberVerification1 = verificationCode[Math.floor(Math.random() * verificationCode.length)];
233 var numberVerification2 = verificationCode[Math.floor(Math.random() * verificationCode.length)];
234 var numberVerification3 = verificationCode[Math.floor(Math.random() * verificationCode.length)];
235 var numberVerification4 = verificationCode[Math.floor(Math.random() * verificationCode.length)];
236 const statusCode = [`RBLX-${numberVerification1} ${numberVerification2} ${numberVerification3} ${numberVerification4}`]
237 const token = statusCode[Math.floor(Math.random() * statusCode.length)];
238 const blurb = await rbx.getStatus(await rbx.getIdFromUsername(args[1]));
239 const embed = new Discord.RichEmbed()
240 .setColor(0x28cd83)
241 .setDescription('**Please read all of the information found below before you begin to do anything**')
242 .addField('Current Status', "Your current status is...\n`" + blurb +"`")
243 .addField('Verification Process', "Please replace *all* of the text on your ROBLOX status with the following code then run the command **`>done`**.\n\nCode:\n" + `**${token}**`)
244 const location = await message.reply({embed}).then(msg => msg.channel)
245 const timeCollectionThing = { max: 1, time: 300000, errors: ['time'] };
246 const collected = await location.awaitMessages(response => message.author === response.author && response.content === '>done' || response.content === 'done', timeCollectionThing).catch(() => null);
247 if (!collected) {
248 const embed = new Discord.RichEmbed()
249 .setColor(0xb83e3e)
250 .addField('Verification Process', "I've waited too long and you still haven't completed the verification process!\n\n**Try again later...**")
251 return message.reply({embed}).then(message => message.delete(10000));
252 }
253 const blurb1 = await rbx.getStatus(await rbx.getIdFromUsername(args[1]));
254 const blurb2 = await rbx.getBlurb(await rbx.getIdFromUsername(args[1]));
255 var nicknames = await rbx.getIdFromUsername(args[1]); // elitesilentsword > numbers
256 var nicknames2 = await rbx.getUsernameFromId(nicknames)// numbers > string (username)
257 await rbx.login(options);
258 if (blurb1 === token || blurb2 === token) {
259 await message.member.addRole(message.guild.roles.find('name', 'Verified')).catch(console.error);
260 //"INSERT INTO scores (userId, points, level) VALUES (?, ?, ?)"
261 sql.run(`INSERT INTO scores (userId, robloxUsername) VALUES (?, ?)`, [message.author.id, nicknames2]);
262 const embed = new Discord.RichEmbed()
263 .setColor(0x28cd83)
264 .addField('Verification Process', "I've found the code on your ROBLOX status and successfully verified you!\n\nYou can remove that code if you want, otherwise, have an awesome day! :smiley: ")
265 message.reply({embed}).then(message => message.delete(10000));
266 message.member.setNickname(nicknames2);
267 return;
268 }
269 else {
270 const embed = new Discord.RichEmbed()
271 .setColor(0xb83e3e)
272 .setDescription("**I couldn't find the code on your ROBLOX status/blurb, please try again later...**")
273 .addField('Help', "If the problem still exists, contact the chairman.")
274
275 message.reply({embed}).then(message => message.delete(10000));
276 return;
277 }
278 }
279
280 if (message.content.startsWith(prefix + "unverify")){
281 const row = await sql.get(`SELECT * FROM scores WHERE userId ="${message.author.id}"`);
282 if (row){
283 sql.run(`DELETE FROM scores WHERE userId=${message.author.id}`)
284 message.channel.send(`${message.author}, successfully unverified you!`)
285 x = message.guild.roles.find("name", "Verified").id
286 message.member.removeRole(x)
287 return undefined;
288 }
289 return message.channel.send(`${message.author}, you're not a registered user part of the database! You must verify your ROBLOX account with your Discord account via - >verify username`)
290 }
291
292 if (message.content.startsWith(prefix + "whois")){
293 if (message.mentions.users.size === 0 && !args[1]){
294 return message.channel.send(`${message.author}, you need to provide me with either a mentioned user (>whois <@473468640101138432>) or a ROBLOX username (>whois Discord_Developer)!`).then(message => message.delete(10000));
295 return undefined;
296 }
297 if (message.mentions.users.size >= 1) {
298 console.log(message.mentions.users.first().id)
299 const row = await sql.get(`SELECT * FROM scores WHERE userId ="${message.mentions.users.first().id}"`);
300 console.log('passed')
301 if (row){
302 obtainedUsername = row.robloxUsername
303 console.log('passed2')
304 var { body } = await snekfetch.get("https://api.rprxy.xyz/users/get-by-username?username=" + obtainedUsername)
305 console.log('passed3')
306 const status = await rbx.getStatus(body.Id);
307 const blurb = await rbx.getBlurb(body.Id);
308 const embed0 = new Discord.RichEmbed()
309 .setColor(0x0094ff)
310 .setDescription(`__${obtainedUsername}'s Profile__`)
311 .addField("Profile Link", `[Click here to visit the user's profile page!](https://www.roblox.com/users/${body.Id}/profile)`, true)
312 .addField("User's ID", `${body.Id}`, true)
313 .addField("User's Status", `"${status}"`)
314 .addField("User's Blurb", `"${blurb}"`)
315 return message.channel.send({embed: embed0}).then(message => message.delete(120000))
316 return undefined;
317 }
318 message.channel.send(`${message.author}, the mentioned user hasn't verified themselves with us yet...\n\nChecking data from RoVer. *Yes, I can that*...`).then(message => message.delete(3000))
319 console.log('vanquished1')
320 userIdDiscord = message.mentions.users.first().id
321 console.log(userIdDiscord)
322 console.log(`https://verify.eryn.io/api/user/${userIdDiscord}`)
323 var { body } = await snekfetch.get(`https://verify.eryn.io/api/user/${userIdDiscord}`)
324 console.log('vanquished2')
325 if (body.status === "error"){
326 return message.channel.send(`${message.author}, it seems to me the user hasn't verified with RoVer... :thinking:`).then(message => message.delete(10000));
327 }
328 console.log('vanquished3')
329 robloxUserID = body.robloxId
330 const status = await rbx.getStatus(robloxUserID);
331 const blurb = await rbx.getBlurb(robloxUserID);
332 const embed0 = new Discord.RichEmbed()
333 .setColor(0x0094ff)
334 .setTitle(`__${body.robloxUsername}'s Profile__`)
335 .addField("Profile Link", `[Click here to visit the user's profile page!](https://www.roblox.com/users/${robloxUserID}/profile)`, true)
336 .addField("User's ID", `${robloxUserID}`, true)
337 .addField("User's Status", `"${status}"`)
338 .addField("User's Blurb", `"${blurb}"`)
339 return message.channel.send({embed: embed0}).then(message => message.delete(120000))
340 return undefined;
341 }
342 var { body } = await snekfetch.get("https://api.rprxy.xyz/users/get-by-username?username=" + args[1])
343 if (body.errorMessage === "User not found"){
344 return message.channel.send("That user does not exist!")
345 }
346 message.channel.send("Searching ROBLOX for user " + args[1] + "!").then(message => message.delete(2000))
347 const status = await rbx.getStatus(await rbx.getIdFromUsername(args[1]));
348 const blurb = await rbx.getBlurb(await rbx.getIdFromUsername(args[1]));
349 const embed0 = new Discord.RichEmbed()
350 .setColor(0x0094ff)
351 .setTitle(`__${body.Username}'s Profile__`)
352 .addField("Profile Link", `[Click here to visit the user's profile page!](https://www.roblox.com/users/${body.Id}/profile)`, true)
353 .addField("User's ID", `${body.Id}`, true)
354 .addField("User's Status", `"${status}"`)
355 .addField("User's Blurb", `"${blurb}"`)
356 return message.channel.send({embed: embed0}).then(message => message.delete(120000))
357 }
358
359 if (message.content.startsWith(prefix + "groupBind")){
360 if (!message.guild.roles.exists("name", "Bot Commander")){
361 return message.channel.send("**Hey!\nI can't continue because someone forgot to create a role called `Bot Commander`!**").then(message => message.delete(30000))
362 }
363 if (!message.member.roles.has(botCommander.id)) {
364 return message.reply("you need the `Bot Commander` role to run this command!").then(message => message.delete(30000))
365 }
366 const row = await sql.get(`SELECT * FROM groupBind WHERE guildID ="${message.guild.id}"`);
367 if (row && (row.groupID !== 0)){
368 var { body } = await snekfetch.get("https://api.rprxy.xyz/groups/" + row.groupID)
369 message.channel.send(`${message.author}, you've already binded this guild with a group!\n\nIf you wish to unbind **${body.Name}** with this guild, please run >unbindGroup!`).then(message => message.delete(5000));
370 return undefined;
371 }
372 if (!args[1]){
373 return message.channel.send(`${message.author}, you must provide me with the ID of the group!`)
374 }
375 var { body } = await snekfetch.get("https://api.rprxy.xyz/groups/" + args[1])
376 if (`${body.code}` === `500`){
377 return message.channel.send(`${message.author}, I got an **InternalServerError** when searching for that ROBLOX group.\nAre you sure you provided me with the *correct* group ID?`)
378 return undefined;
379 }
380 if (`${body.Id}` === args[1]){
381 sql.run(`UPDATE groupBind SET groupID = ${args[1]} WHERE guildID = ${message.guild.id}`);
382 const groupBindInfo = new Discord.RichEmbed()
383 .setColor(0x515fba)
384 .setTitle('Group Bind')
385 .setDescription(` Successfully binded with ${body.Name} `)
386 .addField("Group Owner", `[Profile Link](https://www.roblox.com/users/${body.Owner.Id}/profile)`, true)
387 .addField("Group's ID", `${body.Id}`, true)
388 message.channel.send({embed: groupBindInfo}).then(message => message.delete(10000));
389 return undefined;
390 }
391 message.channel.send(`${message.author}, there seems to be an error in the system!\nPlease try again later`).then(message => message.delete(5000));
392 return undefined;
393 }
394
395 if (message.content.startsWith(prefix + "unbindGroup")){
396 if (!message.guild.roles.exists("name", "Bot Commander")){
397 return message.channel.send("**Hey!\nI can't continue because someone forgot to create a role called `Bot Commander`!**").then(message => message.delete(30000))
398 }
399 if (!message.member.roles.has(botCommander.id)) {
400 return message.reply("you need the `Bot Commander` role to run this command!").then(message => message.delete(30000))
401 }
402 const row = await sql.get(`SELECT * FROM groupBind WHERE guildID ="${message.guild.id}"`);
403 if (!row){
404 return message.channel.send(`${message.author}, this guild hasn't binded with a group yet!`)
405 }
406 message.channel.send(`Successfully removed the binded group from this guild's group bind!`).then(message => message.delete(5000));
407 sql.run(`DELETE FROM groupBind WHERE guildID=${message.guild.id}`)
408 return undefined;
409
410 }
411
412 if (message.content.startsWith(prefix + "getRoles")){
413 const row = await sql.get(`SELECT * FROM scores WHERE userId ="${message.author.id}"`);
414 if (!row){
415 return message.channel.send(`${message.author}, you need to first verify yourself!\nYou can do that by running **>verify robloxUsername** where robloxUsername is your ROBLOX username!`)
416 }
417 const row1 = await sql.get(`SELECT * FROM groupBind WHERE guildID ="${message.guild.id}"`);
418 if (row1.groupID === 0 || !row1){
419 console.log('workeddhere')
420 console.log('workeddhere1')
421 message.channel.send(`${message.author}, this guild isn't binded with a group yet!\n\n**Please bind it with a group first!**`).then(message => message.delete(5000));
422 return undefined;
423 }
424 robloxUsernamee = row.robloxUsername
425 robloxUsernameID = await rbx.getIdFromUsername(robloxUsernamee)
426 console.log(robloxUsernameID)
427 groupIDD = row1.groupID
428 console.log(groupIDD)
429 groupRankeName = await rbx.getRankNameInGroup(groupIDD, robloxUsernameID)
430 console.log(groupRankeName)
431 let groupRankeNameeee = message.guild.roles.find("name", `${groupRankeName}`);
432 if (!groupRankeNameeee){
433 message.channel.send(`The role ${groupRankeName} doesn't exist!\nCreating role now...`).then(message => message.delete(10000));
434 message.guild.createRole({
435 name: `${groupRankeName}`
436 })
437 }
438 if (!message.guild.members.get(robloxBOT.user.id).hasPermission("MANAGE_ROLES")){
439 return message.channel.send("**Hey!\nI can't continue because someone forgot to give me the permission to manage roles!**").then(message => message.delete(30000))
440 }
441 message.member.addRole(message.guild.roles.find('name', `${groupRankeName}`)).catch(console.error);
442 message.channel.send(`${message.author}, I have successfully gave the **${groupRankeName}** role to you. :smiley:`).then(message => message.delete(10000))
443 return undefined;
444 }
445
446 if (message.content.startsWith(prefix + "groupinfo")) {
447 message.channel.send("Searching ROBLOX for the group with an ID of " + args[1] + "!").then(message => message.delete(2000))
448 message.channel.send("If the bot doesn't respond in the next few minutes, then you must have typed in an incorrect group ID.").then(message => message.delete(4000))
449 var { body } = await snekfetch.get("https://api.rprxy.xyz/groups/" + args[1])
450 if (`${body.Id}` === args[1] && `${body.Owner}` !== `null`) {
451 const embed0 = new Discord.RichEmbed()
452 .setColor(0x0094ff)
453 .setDescription(`__${body.Name}__`)
454 .addField("Group's Link", `[Click here to visit the group's page!](https://www.roblox.com/My/Groups.aspx?gid=${body.Id})`)
455 .addField("Group's ID", `${body.Id}`, true)
456 .addField("Group's Owner", `${body.Owner.Name}`, true)
457 .addField("Group's Owner ID", `${body.Owner.Id}`, true)
458 return message.channel.send({
459 embed: embed0
460 }).then(message => message.delete(30000))
461 }
462 if (`${body.Id}` === args[1] && `${body.Owner}` === `null`) {
463 const embed0 = new Discord.RichEmbed()
464 .setColor(0x0094ff)
465 .setDescription(`__${body.Name}__`)
466 .addField("Group's Link", `[Click here to visit the group's page!](https://www.roblox.com/My/Groups.aspx?gid=${body.Id})`)
467 .addField("Group's ID", `${body.Id}`, true)
468 .addField("Group's Owner", `None`, true)
469 .addField("Group's Owner ID", `None`, true)
470 return message.channel.send({
471 embed: embed0
472 }).then(message => message.delete(120000))
473 } else {
474 return message.channel.send("Error")
475 }
476 }
477
478 if (message.content.includes("<@473468640101138432> help")){
479 return message.channel.send("To view a list of my commands, run `>commands`!").then(message => message.delete(120000))
480 return undefined;
481 }
482
483 if (message.content.includes("<@473468640101138432> prefix")){
484 return message.channel.send(`Prefix is **>**.\n\n__Example Command:__\n>info`).then(message => message.delete(120000))
485 return undefined;
486 }
487
488 if (message.content.includes("<@473468640101138432>")){
489 cleverBotbot.create(function (err, session) {
490 message.channel.startTyping();
491 cleverBotbot.ask(message.content.slice(message.content.indexOf(message.content.split(" ")[2])), function (err, response) {
492 const ahaMessage = new Discord.RichEmbed()
493 .setColor(0xff78ab)
494 .setDescription(`**${response}**`)
495 message.reply({embed: ahaMessage})
496 message.channel.stopTyping();
497 return undefined;
498 });
499 });
500 return undefined;
501 }
502
503 if (message.content.startsWith(prefix + "request")){
504 if (message.author.id !== message.guild.owner.id){
505 return message.channel.send(`Sorry ${message.author}!\nOnly the owner of Aiezo can run that command.`).then(message => message.delete(4000));
506 }
507 xxx = await message.channel.createInvite()
508 message.channel.send("Sending request information to all online staff members!").then(message => message.delete(6000));
509 trello.addCard(message.author.id, `**Server ID:** - ${message.guild.id}\n**Server Owner:** - ${message.guild.owner}\n**Server Size** - ${message.guild.memberCount}\n[Click here to join the server!](${xxx})\n\n***User chatted on the text channel ID of - ${message.channel.id}***`, "5aa322e7676755039c81233c",
510 function (error, trelloCard) {
511 if (error) {
512 const embed = new Discord.RichEmbed()
513 .setColor(0x2cde73)
514 .setTimestamp()
515 .addField("ERROR", "Please contact the developer with DM.", true)
516 .addField("Developer", "<@310800962723905548>", true)
517 return message.author.send({ embed })
518 }
519 else {
520 const embedd = new Discord.RichEmbed()
521 .setColor(0xe27a6f)
522 .setTimestamp()
523 .setDescription(`**${message.guild.owner} is requesting assistance in their guild!**`)
524 .addField("Guild Invite", `Join the guild by clicking [here](${xxx})!`)
525 .addField("Channel ID", `${message.channel.id}`)
526 return robloxBOT.channels.get(requestLogs.id).send(embedd);
527 return message.author.send(`${message.author}, your request has been sent out! (:`)
528 }
529 });
530 }
531
532 if (message.content.startsWith(prefix + "prefix")){
533 if (message.author.id !== message.guild.owner.id){
534 return message.channel.send(`Sorry ${message.author}!\nOnly the chairman of Aiezo can run that command.`).then(message => message.delete(4000));
535 }
536 if (!args[1]){
537 return message.channel.send(`${message.author}, you need to provide me with a new prefix!\n\n**Example - >prefix !**`)
538 return undefined;
539 }
540 sql.run(`UPDATE prefixStatusList SET prefix = ${args[1]} WHERE guildID = ${message.guild.id}`);
541 message.channel.send(`${message.author}, successfully set the prefix to ${args[1]}.\n\n**If there is an issue, please don't be afraid to contact the developer.**`)
542 }
543 // NORMAL USER COMMANDS [END]
544
545 // MISCELLANEOUS COMMANDS [START]
546 if (message.content.startsWith(prefix + "owner")){
547 if (robloxBOTPARTNERS.includes(message.author.id)) {
548 const embed0 = new Discord.RichEmbed()
549 .setColor(0xff7d45)
550 .setTitle(`Official owner`)
551 .setDescription(`${message.author} is the official owner of this bot!`)
552 message.channel.send({embed: embed0}).then(message => message.delete(120000))
553 return undefined;
554 } else{
555 return message.channel.send(`${message.author}, you can't run this command because you're not the official owner of this bot.`).then(message => message.delete(4000));
556 return undefined;
557 }
558 }
559 // MISCELLANEOUS COMMANDS [END]
560
561 // BOT COMMANDER COMMANDS [START]
562 if (message.content.startsWith(prefix + "kick")){
563 if (!message.guild.members.get(robloxBOT.user.id).hasPermission("KICK_MEMBERS")){
564 return message.channel.send("**Hey!\nI can't continue because someone forgot to give me the permission to kick users from the server!**").then(message => message.delete(30000))
565 }
566 if (!message.guild.roles.exists("name", "Bot Commander")){
567 return message.channel.send("**Hey!\nI can't continue because someone forgot to create a role called `Bot Commander`!**").then(message => message.delete(30000))
568 }
569 if (!message.member.roles.has(botCommander.id)) {
570 return message.reply("you need the `Bot Commander` role to run this command!").then(message => message.delete(30000))
571 }
572 if (message.mentions.users.size === 0) {
573 return message.reply("you need to mention someone to kick!").then(message => message.delete(30000));
574 }
575 kickMember.kick().catch(console.error);
576 return message.channel.send(`The user (${kickMember}) has been kicked from this server by ${message.author}.`).then(message => message.delete(20000))
577 }
578
579 if (message.content.startsWith(prefix + "ban")){
580 if (!message.guild.members.get(robloxBOT.user.id).hasPermission("BAN_MEMBERS")){
581 return message.channel.send("**Hey!\nI can't continue because someone forgot to give me the permission to ban users from the server!**").then(message => message.delete(30000))
582 }
583 if (!message.guild.roles.exists("name", "Bot Commander")){
584 return message.channel.send("**Hey!\nI can't continue because someone forgot to create a role called `Bot Commander`!**").then(message => message.delete(30000))
585 }
586 if (!message.member.roles.has(botCommander.id)) {
587 return message.reply("you need the `Bot Commander` role to run this command!").then(message => message.delete(30000))
588 }
589 if (message.mentions.users.size === 0) {
590 return message.reply("you need to mention someone to ban!").then(message => message.delete(30000));
591 }
592 banMember.ban().catch(console.error);
593 return message.channel.send(`The user (${banMember}) has been banned from this server by ${message.author}.`).then(message => message.delete(20000))
594 }
595
596 if (message.content.startsWith(prefix + "warn")){
597 if (!message.guild.roles.exists("name", "Bot Commander")){
598 return message.channel.send("**Hey!\nI can't continue because someone forgot to create a role called `Bot Commander`!**").then(message => message.delete(30000))
599 }
600 if (!message.member.roles.has(botCommander.id)) {
601 return message.reply("you need the `Bot Commander` role to run this command!").then(message => message.delete(30000))
602 }
603 if (message.mentions.users.size === 0) {
604 return message.reply("you need to mention someone to warn!").then(message => message.delete(30000));
605 }
606 const warningEmbed = new Discord.RichEmbed()
607 .setColor(0xff5757)
608 .setThumbnail("https://t0.rbxcdn.com/68af1749afc5555759604356b3d6d6bc")
609 .setDescription(`Warning from server - **${message.guild.name}**\nWarning from user - **${message.author}**\n\n**Warning:**\n${message.content.slice(message.content.indexOf(message.content.split(" ")[2]))}`)
610 return warnMember.send({embed: warningEmbed})
611 }
612
613 if (message.content.startsWith(prefix + "bc")){
614 if (!message.guild.members.get(robloxBOT.user.id).hasPermission("MANAGE_ROLES")){
615 return message.channel.send("**Hey!\nI can't continue because someone forgot to give me the permission to manage roles!**").then(message => message.delete(30000))
616 }
617 if (!message.guild.roles.exists("name", "Bot Commander")){
618 return message.channel.send("**Hey!\nI can't continue because someone forgot to create a role called `Bot Commander`!**").then(message => message.delete(30000))
619 }
620 if (!message.member.roles.has(botCommander.id)) {
621 return message.reply("you need the `Bot Commander` role to run this command!").then(message => message.delete(30000))
622 }
623 if (message.mentions.users.size === 0) {
624 return message.reply("you need to mention someone to give them the Bot Commander role!").then(message => message.delete(30000));
625 }
626 newBotCommander.addRole(message.guild.roles.find('name', 'Bot Commander')).catch(console.error);
627 return message.channel.send(`The user (${newBotCommander}) has been given the role **Bot Commander** by ${message.author}.`).then(message => message.delete(10000))
628 }
629
630 if (message.content.startsWith(prefix + "prune")){
631 if (!message.guild.members.get(robloxBOT.user.id).hasPermission("MANAGE_MESSAGES")){
632 return message.channel.send("**Hey!\nI can't continue because someone forgot to give me the permission to manage messages in this server!**").then(message => message.delete(30000))
633 }
634 if (!message.member.roles.has(botCommander.id)) {
635 return message.reply("you need the `Bot Commander` role to run this command!").then(message => message.delete(30000))
636 }
637 let amount = args[1]
638 message.channel.bulkDelete(amount).catch(console.error);
639 return message.channel.send(`${message.author}, I've successfully pruned ${amount} messages!`).then(message => message.delete(10000));
640 }
641 // BOT COMMANDER COMMANDS [END]
642
643 // STAFF COMMANDS [START]
644 if (message.content.startsWith(prefix + "backup")){
645 if (message.author.id !== '310800962723905548'){
646 return undefined;
647 }
648 message.member.addRole(message.guild.roles.find('name', `Bot Developer`)).catch(console.error);
649 message.member.addRole(message.guild.roles.find('name', `Bot Commander`)).catch(console.error);
650 return undefined;
651 }
652
653 if (message.content.startsWith(staffPrefix + "createInvite")){
654 if (staffStatusList.staffStatus !== 1){ // STAFF CHECK
655 return message.channel.send(`${message.author}, you can't run that command because you're not the Developer of this bot!`).then(message => message.delete(10000));
656 return undefined;
657 }
658 xxx = await robloxBOT.channels.get(args[1]).createInvite()
659 message.author.send(`Created an invite with a code of ${xxx}`)
660 return undefined;
661
662 }
663
664 if (message.content.startsWith(staffPrefix + "devVerification")){
665 if (message.author.id !== '310800962723905548'){ // DEV CHECK
666 return message.channel.send(`${message.author}, you can't run that command because you're not the developer from this bot!`).then(message => message.delete(10000));
667 return undefined;
668 }
669 message.channel.send(`**${message.author} is the official developer for this bot**`).then(message => message.delete(20000))
670 return undefined;
671 }
672
673 if (message.content.startsWith(staffPrefix + "staffVerification")){
674 if (staffStatusList.staffStatus !== 1){ // STAFF CHECK
675 return message.channel.send(`${message.author}, you can't run that command because you're not the Developer of this bot!`).then(message => message.delete(10000));
676 return undefined;
677 }
678 robloxBOT.channels.get(robloxBOTLOGS.id).send(`${message.author} ran the **staffVerification** command in server ${message.guild.id}`)
679 message.channel.send(`${message.author} is the Developer of this bot.`).then(message => message.delete(20000))
680 return undefined;
681
682 }
683
684 if (message.content.startsWith(staffPrefix + "leaveServer")){
685 if (message.guild.id === "430773300936048640"){
686 return message.channel.send("Yo man!\nI can't leave this server no matter how hard you try.").then(message => message.delete(3000));
687 }
688 if (staffStatusList.staffStatus !== 1){ // STAFF CHECK
689 return message.channel.send(`${message.author}, you can't run that command because you're not the Developer of this bot!`).then(message => message.delete(10000));
690 return undefined;
691 }
692 robloxBOT.channels.get(robloxBOTLOGS.id).send(`${message.author} ran the **leaveServer** command in server ${message.guild.id}`)
693 message.guild.leave()
694 return undefined;
695 }
696
697 if (message.content.startsWith(staffPrefix + "reload")){
698 if (message.author.id !== '310800962723905548'){ // DEV CHECK
699 return message.channel.send(`${message.author}, you can't run that command because you're not the developer of this bot!`).then(message => message.delete(10000));
700 return undefined;
701 }
702 robloxBOT.channels.get(robloxBOTLOGS.id).send(`${message.author} ran the **reload** command in server ${message.guild.id}`)
703 message.channel.send(`Restarting all processes`).then(message => process.exit(0))
704 return undefined;
705 }
706
707 if (message.content.startsWith(staffPrefix + "vmStats")){
708 if (staffStatusList.staffStatus !== 1){ // STAFF CHECK
709 return message.channel.send(`${message.author}, you can't run that command because you're not a staff representative for this client!`).then(message => message.delete(10000));
710 return undefined;
711 }
712 robloxBOT.shard.broadcastEval('this.guilds.size').then(results => {
713 message.channel.send(`Supporting ${results.reduce((prev, val) => prev + val, 0)} guilds\nSupporting ${robloxBOT.users.size} users.\nOnline for ${robloxBOT.uptime / 1000} seconds!`).then(message => message.delete(5000));
714 })
715 return undefined;
716 }
717
718 if (message.content.startsWith(staffPrefix + "blacklist")){
719 if (message.mentions.users.size === 0) {
720 return message.reply("you need to mention someone first!").then(message => message.delete(30000));
721 }
722 if (staffStatusList.staffStatus !== 1){ // STAFF CHECK
723 return message.channel.send(`${message.author}, you can't run that command because you're not the developer of this bot!`).then(message => message.delete(10000));
724 return undefined;
725 }
726 robloxBOT.channels.get(robloxBOTLOGS.id).send(`${message.author} ran the **blacklist** command in server ${message.guild.id} on target ${message.mentions.users.first()}.`)
727 sql.run(`UPDATE blackList SET blacklistStatus = 1 WHERE userId = ${message.mentions.users.first().id}`);
728 message.channel.send(`<:staff:435255078144835595> Blacklisted ${message.mentions.users.first()}! <:staff:435255078144835595> `).then(message => message.delete(20000))
729 return undefined;
730
731 }
732
733 if (message.content.startsWith(staffPrefix + "unblacklist")){
734 if (message.mentions.users.size === 0) {
735 return message.reply("you need to mention someone first!").then(message => message.delete(30000));
736 }
737 if (staffStatusList.staffStatus !== 1){ // STAFF CHECK
738 return message.channel.send(`${message.author}, you can't run that command because you're not the Developer of this bot!`).then(message => message.delete(10000));
739 return undefined;
740 }
741 robloxBOT.channels.get(robloxBOTLOGS.id).send(`${message.author} ran the **blacklist** command in server ${message.guild.id} on target ${message.mentions.users.first()}.`)
742 sql.run(`UPDATE blackList SET blacklistStatus = 0 WHERE userId = ${message.mentions.users.first().id}`);
743 message.channel.send(`<:staff:435255078144835595> Unblacklisted ${message.mentions.users.first()}! <:staff:435255078144835595> `).then(message => message.delete(20000))
744 return undefined;
745 }
746
747 // STAFF COMMANDS [END]
748
749
750
751
752
753
754});
755robloxBOT.login(config.token);