From cf247b15dac719709c23ad6f5d31d7a62a15dd33 Mon Sep 17 00:00:00 2001 From: AnxietyisReal <96593068+AnxietyisReal@users.noreply.github.com> Date: Mon, 14 Nov 2022 00:46:50 +1100 Subject: [PATCH] Push part 2 --- src/client.ts | 312 +++- src/commands/eval.ts | 65 + src/commands/ping.ts | 12 + src/database.js | 72 - src/database.ts | 69 + src/database/MPPlayerData.json | 2 +- src/database/bannedWords.json | 2 +- src/database/bonkCount.json | 2 +- src/database/dailyMsgs.json | 2 +- src/database/punishments.json | 99 +- src/database/userLevels.json | 2683 +++++++++++++++++++++++++++++++- src/events/messageCreate.ts | 132 ++ src/index.ts | 265 +++- 13 files changed, 3593 insertions(+), 124 deletions(-) create mode 100644 src/commands/eval.ts create mode 100644 src/commands/ping.ts delete mode 100644 src/database.js create mode 100644 src/database.ts create mode 100644 src/events/messageCreate.ts diff --git a/src/client.ts b/src/client.ts index 92c300a..2a8feeb 100644 --- a/src/client.ts +++ b/src/client.ts @@ -1,9 +1,34 @@ -import { Client, GatewayIntentBits, Partials } from 'discord.js'; -import Discord = require('discord.js'); -import fs = require('node:fs'); -import database from './database'; +interface createTableOpt { + columnAlign: any, + columnSeparator: any, + columnEmptyChar: any +} +interface formatTimeOpt { + longNames: boolean, + commas: boolean +} +interface Punishment { + id: number; + type: string; + member: string; + moderator: string; + expired?: boolean; + time?: number; + reason: string; + endTime?: number; + cancels?: number; + duration?: number; +} +interface CommandInfoOpt { + insertNewline: boolean, + parts: string[], //idfk + titles: string[] +} +import Discord, { Client, GatewayIntentBits, Partials } from 'discord.js'; +import fs from 'node:fs'; +import { Database } from './database'; import timeNames from './timeNames.js'; -class TClient extends Client { +export class TClient extends Client { invites: any; commands: any; config: any; @@ -17,11 +42,13 @@ class TClient extends Client { messageCollector: any; attachmentBuilder: any; moment: any; + xjs: any; + axios: any; memberCount_LastGuildFetchTimestamp: any; - userLevels: any; - punishments: any; - bonkCount: any; - bannedWords: any; + userLevels: Database; + punishments: Database; + bonkCount: Database; + bannedWords: Database; repeatedMessages: any; setMaxListeners: any; @@ -38,7 +65,7 @@ class TClient extends Client { Partials.Reaction, Partials.Message ], - allowedMentions: { repliedUser: false } + allowedMentions: { repliedUser: false, parse: ['roles', 'users'] } }) this.invites = new Map(); this.commands = new Discord.Collection(); @@ -58,14 +85,16 @@ class TClient extends Client { this.collection = Discord.Collection; this.messageCollector = Discord.MessageCollector; this.attachmentBuilder = Discord.AttachmentBuilder; - this.moment = require('moment'); + this.moment = import('moment'); + this.xjs = import('xml-js'); + this.axios = import('axios'); this.memberCount_LastGuildFetchTimestamp = 0; - this.userLevels = new database('./database/userLevels.json', 'object'); - this.bonkCount = new database('./database/bonkCount.json', 'object'); - this.punishments = new database('./database/punishments.json', 'array'); - this.bannedWords = new database('./database/bannedWords.json', 'array'); + this.userLevels = new Database('./database/userLevels.json', 'object'); + this.bonkCount = new Database('./database/bonkCount.json', 'object'); + this.punishments = new Database('./database/punishments.json', 'array'); + this.bannedWords = new Database('./database/bannedWords.json', 'array'); this.repeatedMessages = {}; - this.setMaxListeners(20) + this.setMaxListeners(80) } async init(){ this.login(this.tokens.token_toast); @@ -74,13 +103,72 @@ class TClient extends Client { this.bonkCount.initLoad(); this.userLevels.initLoad().intervalSave(15000).disableSaveNotifs(); } - formatPunishmentType(punishment: any, client: any, cancels: any){ + commandInfo(client: TClient, command: any, options?: CommandInfoOpt){ + let text = ':small_orange_diamond: '; + if (!options.titles) options.titles = []; + function e(){ + text += '\n'; + if (options.insertNewline){ + text += '\n'; + } return; + } + if (options.parts.includes('name') && command.name){ + if (options.titles.includes('name') && options.titles.includes('usage')){ + text += 'Name & Usage: '; + } else if (options.titles.includes('name')){ + text += 'Name: '; + } + text += '`' + client.config.prefix + command.name; + if (options.parts.includes('usage') && command.usage){ + text += ' ' + command.usage.map((x:string)=>x.startsWith('?') ? '?['+x.slice(1)+']' : '['+x+']').join(' '); + } + text += '`'; + e(); + } else if (options.parts.includes('usage') && command.usage){ + if (options.titles.includes('usage')) text += 'Usage: '; + text += '`'+command.usage.map((x:string)=>x.startsWith('?') ? '?['+x+']' : '['+x+']').join(' ') + '`'; + e(); + } + if (options.parts.includes('description') && command.description){ + if (options.titles.includes('description')) text += 'Description: '; + text += command.description; + e(); + } + if (options.parts.includes('shortDescription')){ + if (command.shortDescription){ + if (options.titles.includes('shortDescription')) text += 'Shorter description: '; + text += command.shortDescription; + e(); + } else if (!options.titles.includes('shortDescription') && command.description){ + text += command.description; + e(); + } + } + if (options.parts.includes('alias') && command.alias){ + if (options.titles.includes('alias')) text += 'Aliases: '; + text += command.alias.map((x:any)=>'`'+x+'`').join(', '); + e(); + } + if (options.parts.includes('category') && command.category){ + if (options.titles.includes('category')) text += 'Category: '; + text += command.category; + e(); + } + if (options.parts.includes('autores') && command.autores){ + if (options.titles.includes('autores')) text += 'AutoResponse:tm: Requirements: '; + text += '`['+command.autores.join('] [')+']`'; + e(); + } + e(); + return text; + } + formatPunishmentType(punishment: Punishment, client: TClient, cancels: Punishment){ if (punishment.type == 'removeOtherPunishment'){ - cancels ||= this.punishments._content.find(x=>x.id === punishment.cancels) + cancels ||= this.punishments._content.find((x: Punishment)=>x.id === punishment.cancels) return cancels.type[0].toUpperCase()+cancels.type.slice(1)+' Removed'; } else return punishment.type[0].toUpperCase()+punishment.type.slice(1); } - formatTime(integer: number, accuracy = 1, options = {}){ + formatTime(integer: number, accuracy = 1, options?: formatTimeOpt){ let achievedAccuracy = 0; let text = ''; const { longNames, commas } = options @@ -95,19 +183,189 @@ class TClient extends Client { break; } } - if (text.length == 0) text = integer + (longNames ? ' milliseconds' : 'ms') + (commas ? ', ' : ''); - if (commas){ + if (text.length == 0) text = integer + (options?.longNames ? ' milliseconds' : 'ms') + (options?.commas ? ', ' : ''); + if (options?.commas){ text = text.slice(0, -2); - if (longNames){ + if (options?.longNames){ text = text.split(''); text[text.lastIndexOf(',')] = ' and'; text = text.join(''); } } return text.trim(); } -} -module.exports = TClient; + isStaff(guildMember: Discord.GuildMember){ + return this.config.mainServer.staffRoles.map((x: string)=>this.config.mainServer.roles[x]).some((x: string)=>guildMember.roles.cache.has(x)) + } + alignText(text: string, length: number, alignment: string, emptyChar = ' '){ + if (alignment == 'right'){ + text = emptyChar.repeat(length - text.length)+text; + } else if (alignment == 'middle'){ + const emptyCharsPerSide = (length - text.length)/2; + text = emptyChar.repeat(Math.floor(emptyCharsPerSide))+text+emptyChar.repeat(Math.floor(emptyCharsPerSide)); + } else { + text = text + emptyChar.repeat(length - text.length); + } return text; + } + createTable(columnTitles = [], rowsData = [], options: createTableOpt, client: TClient){ + const rows: any = []; + let { columnAlign = [], columnSeparator = [], columnEmptyChar = [] } = options; + if (columnSeparator.length < 1) columnSeparator.push('|'); + columnSeparator = columnSeparator.map((x: string)=>`${x}`); + // col widths + const columnWidths = columnTitles.map((title: any, i)=>Math.max(title.length, ...rowsData.map((x: any)=>x[i].length))); + // first row + rows.push(columnTitles.map((title, i)=>{ + let text = client.alignText(title, columnWidths[i], columnAlign[i], columnEmptyChar[i]); + if (columnSeparator[i]){ + text += ' '.repeat(columnSeparator[i].length); + } + return text; + }).join('')) + // big line + rows.push('━'.repeat(rows[0].length)); + //data + // remove unicode + rowsData.map((row: any)=>{ + return row.map((element: string)=>{ + return element.split('').map((char: string)=>{ + if (char.charCodeAt(0)>128) return '□'; + }).join('') + }) + }) + rows.push(rowsData.map((row: any)=>row.map((element: string, i: number)=>{ + return client.alignText(element, columnWidths[i], columnEmptyChar[i])+(i === columnTitles.length - 1 ? '' : columnSeparator[i]); + }).join('') + ).join('\n')) -export function init() { - throw new Error('Function not implemented.'); -} + return rows.join('\n'); + } + makeModlogEntry(data: Punishment, client: TClient){ + const cancels = data.cancels ? client.punishments._content.find((x: Punishment)=>x.id === data.cancels) : null; + + // turn data into embed + const embed = new this.embed().setColor(this.config.embedColor).setTimestamp(data.time) + .setTitle(`${this.formatPunishmentType(data, client, cancels)} | Case #${data.id}`).addFields( + {name: '🔹 User', value: `<@${data.member}> \`${data.member}\``, inline: true}, + {name: '🔹 Moderator', value: `<@${data.moderator}> \`${data.moderator}\``, inline: true}, + {name: '\u200b', value: `\u200b`, inline: true}, + {name: '🔹 Reason', value: `\`${data.reason || 'Unspecified'}\``, inline: true}, + ) + if (data.duration) { + embed.addFields( + {name: '🔹 Duration', value: client.formatTime(data.duration, 100), inline: true}, + {name: '\u200b', value: '\u200b', inline: true} + ) + } + if (data.cancels) embed.addFields({name: '🔹 Overwrites', value: `This case overwrites Case #${cancels.id} \`${cancels.reason}\``}) + // send embed to log channel + (client.channels.cache.get(client.config.mainServer.channels.logs) as Discord.TextChannel).send({embeds: [embed]}) + } + async punish(client: TClient, message: Discord.Message, args: string, type: string){ + let member: any; + if (message.guildId !== client.config.mainServer.id) return message.channel.send('This command doesn\'t work in this server'); + if (!message.member.roles.cache.has(client.config.mainServer.roles.dcmod)) return message.reply(`You need the <@&${client.config.mainServer.roles.dcmod}> role to use this command.`) + if (type == 'ban' && args[1]){ + member = message.mentions.users?.first() || (await client.users.fetch(args[1]).catch(()=>undefined)); + } else if (args[1]){ + member = message.mentions.members?.first() || (await message.guild.members.fetch(args[1]).catch(()=>undefined)); + } + let memberAsked = false; + if (!member){ + memberAsked = true; + await message.channel.send(`Which member would you like to ${type}?\nSend another message with a mention or a user ID. (30s)`).then(async (x:any)=>{ + const filter = m=>m.author.id == message.author.id; + member = await message.channel.awaitMessages({filter, time: 30000, errors: ['time'], max: 1}).then(async (z:any)=>{ + if (z.first().content.startsWith(client.config.prefix)) return 'timedout'; + if (type == 'ban'){ + return z.first().mentions.users?.first() || (await client.users.fetch(z.first().content).catch(()=>undefined)); + } else { + return z.first().mentions.members?.first() || (await message.guild.members.fetch(z.first().content).catch(()=>undefined)) + } + }).catch(async()=>{ + message.channel.send('Command cancelled after 30 seconds of inactivity.'); + return 'timedout'; + }); + }) + } + if (member === 'timedout') return; + else if (!member) return message.channel.send('You failed to mention a member.'); + let time; + let reason; + let col1; // idfk if this should be included here but just wanted to get rid of red underline. + let result: any; + if (args[2] && !memberAsked){ + // if the first character of args 2 is a number, args 2 is the time. otherwise its the reason. + time = (args[2][0].match(/[0-9]/) && !['softban', 'kick', 'warn'].includes(type)) ? args[2] : undefined; + // if time is in args 2, reason starts at args 3. if no time was provided, reason starts at args 2 + reason = args.slice(time ? 3 : 2).join(' '); // "Property 'join' does not exist on type 'string'." :linus: x99 + } else { + if (!['softban', 'kick', 'warn'].includes(type)){ + await message.channel.send(`How long do you want to ${type} this user for?\nSend another message with a time name, or 'forever' to ${type} this user forever. (30s)`); + const filter = m=>m.author.id === message.author.id; + col1 = await message.channel.awaitMessages({filter, time: 30000, errors: ['time'], max: 1}).then(collected=>{ + if (collected.first()?.content.startsWith(client.config.prefix)) return 'timedout'; + return collected.first()?.content.toLowerCase() === 'forever' ? 'inf' : collected.first()?.content; + }).catch(()=>{ + message.channel.send('Command cancelled after 30 seconds of inactivity.'); + return 'timedout'; + }); + if (time === 'timedout') return; + } + await message.channel.send(`Send another message with a reason for this ${type}.\nSend another message with "-" to leave the reason unspecified. (30s)`); + const filter = m=>m.author.id === message.author.id; + reason = await message.channel.awaitMessages({filter, time: 30000, errors: ['time'], max: 1}).then(collected=>{ + if (collected.first()?.content.startsWith(client.config)) return 0; + return collected.first()?.content == '-' ? undefined : collected.first()?.content; + }).catch(()=>{ + message.channel.send('Command cancelled after 30 seconds of inactivity.'); + return 0; + }) + if (reason === 0) return; + } + const punishmentResult = await client.punishments.addPunishment(type, member, {time, reason}, message.author.id, message); + (typeof result == 'string' ? message.reply(punishmentResult) : message.reply({embeds: [punishmentResult]})) + }; + async unPunish(client: TClient, message: Discord.Message, args: string){ + if (message.guildId !== client.config.mainServer.id) return message.channel.send('This command doesn\'t work in this server'); + if (!message.member.roles.cache.has(client.config.mainServer.roles.dcmod)) return message.reply(`You need the <@&${client.config.mainServer.roles.dcmod}> role to use this command.`) + let punishment; + if (args[1]) punishment = client.punishments._content.find((x:any)=>x.id == args[1]) + if (!punishment){ + await message.channel.send(`Which punishment would you like to remove?\nSend another message with a Case # (30s)`).then(async (x:any)=>{ + const filter = m=>m.author.id === message.author.id; + punishment = await message.channel.awaitMessages({filter, time: 30000, errors: ['time'], max: 1}).then(async (z:any)=>{ + return client.punishments._content.find((x:any)=>x.id == z.first()?.content); + }).catch(async()=>{ + message.channel.send('Command cancelled after 30 seconds of inactivity.'); + return 'timedout'; + }); + }) + } + if (punishment === 'timedout') return; + else if (!punishment) return message.channel.send('You failed to mention a Case #'); + //if (punishment.type !== 'warn' && message.member.roles.cache.has(client.config.mainServer.roles.trialmoderator)) return message.channel.send('Trial moderators can only remove warnings.'); + let reason; + if (args[2]){ + reason = args.slice(2).join(' '); // "Property 'join' does not exist on type 'string'." :linus: x50 + }else{ + await message.channel.send(`Send another message with a reason for this ${punishment.type} removal. (30s)\n*Send \`-\` to leave the reason unspecified.*`); + const filter = m=>m.author.id === message.author.id; + reason = await message.channel.awaitMessages({filter, time: 30000, errors: ['time'], max: 1}).then(collected=>collected.first()?.content === '-' ? undefined : collected.first()?.content).catch(()=>0); + if (reason === 0) return message.channel.send('Invalid reason.'); + } + const unpunishResult = await client.punishments.removePunishment(punishment.id, message.author.id, reason); + message.channel.send(unpunishResult); + } + async YTLoop(YTChannelID: string, YTChannelName: string, DCChannelID: string){ + const Data = this.xjs.xml2js((await this.axios.get(`https://www.youtube.com/feeds/videos.xml?channel_id=${YTChannelID}`, {timeout: 5000})), {compact: true, spaces: 2}).catch(()=>{return null}); + if (!Data) return; + if (this.YTCache[YTChannelID] == undefined){ + this.YTCache[YTChannelID] = Data.feed.entry[0]['yt:videoId']._text; + return; + } + if (Data.feed.entry[1]['yt:videoId']._text == this.YTCache[YTChannelID]){ + this.YTCache[YTChannelID] = Data.feed.entry[0]['yt:videoId']._text + (this.channels.resolve(DCChannelID) as Discord.TextChannel).send(`**${YTChannelName}** just uploaded a video!\n${Data.feed.entry[0].link._attributes.href}`) + } + } +} \ No newline at end of file diff --git a/src/commands/eval.ts b/src/commands/eval.ts new file mode 100644 index 0000000..3d2a309 --- /dev/null +++ b/src/commands/eval.ts @@ -0,0 +1,65 @@ +import Discord from 'discord.js'; +import { TClient } from 'src/client'; +import * as util from 'node:util'; +const removeUsername = (text: string)=>{ + let matchesLeft = true; + const array = text.split('\/'); + while (matchesLeft){ + let usersIndex = array.indexOf('home'); + if (usersIndex<1) matchesLeft = false; + else { + let usernameIndex = usersIndex+1; + if(array[usernameIndex].length == 0) usernameIndex += 1; + array[usernameIndex] = '*'.repeat(array[usernameIndex].length); + array[usersIndex] = 'ho\u200bme'; + } + } return array.join('\/'); +}; +export default { + async run(client: TClient, message: Discord.Message, args: any) { + if (!client.config.eval.allowed) return message.channel.send('Eval is disabled.'); + if (!client.config.eval.whitelist.includes(message.author.id)) return message.reply('You\'re not allowed to use this command.'); + const code = message.content.slice(client.config.prefix.length+args[0].length+1); + let output = 'error'; + let error = false; + try { + output = await eval(code) + } catch (err: any) { + error = true + const embed = new client.embed().setColor('ff0000').setTitle('__Eval__').addFields( + {name: 'Input', value: `\`\`\`js\n${code.slice(0, 1010)}\n\`\`\``}, + {name: 'Output', value: `\`\`\`\n${err}\`\`\``} + ) + message.channel.send({embeds: [embed]}).then(errorEmbedMessage=>{ + const filter = x=>x.content === 'stack' && x.author.id === message.author.id + const messagecollector = message.channel.createMessageCollector({filter, max: 1, time: 60000}); + messagecollector.on('collect',collected=>{ + collected.channel.send(`\`\`\`\n${removeUsername(err.stack)}\n\`\`\``); + }); + }); + } + if (error) return; + if (typeof output !== 'string') { + output = 'js\n'+util.formatWithOptions({depth: 1}, '%O', output) + } else { + output = '\n' + String(output); + } + if (typeof output == 'object') { + output = 'js\n'+util.formatWithOptions({depth: 1}, '%O', output) + } else { + output = '\n' + String(output); + } + [client.tokens.token_main,client.tokens.token_beta,client.tokens.token_toast,client.tokens.token_tae].forEach((x)=>{ + const regexp = new RegExp(x,'g'); + output = output.replace(regexp, 'TOKEN_LEAK'); + }) + const embed = new client.embed().setColor(client.config.embedColor).setTitle('__Eval__').addFields( + {name: 'Input', value: `\`\`\`js\n${code.slice(0,1010)}\n\`\`\``}, + {name: 'Output', value: `\`\`\`${removeUsername(output).slice(0,1016)}\n\`\`\``} + ); + message.channel.send({embeds: [embed]}) + }, + name: 'eval', + description: 'Run code for debugging purposes', + category: 'bot' +} \ No newline at end of file diff --git a/src/commands/ping.ts b/src/commands/ping.ts new file mode 100644 index 0000000..716f795 --- /dev/null +++ b/src/commands/ping.ts @@ -0,0 +1,12 @@ +import { TClient } from "src/client"; +import Discord from 'discord.js'; +export default { + async run(client: TClient, message: Discord.Message, args: any){ + const msg = await message.reply(`Pinging...`) + const time = msg.createdTimestamp - message.createdTimestamp; + msg.edit(`Websocket: \`${client.ws.ping}\`ms\nBot: \`${time}\``) + }, + name: 'ping', + description: 'Check bot\'s latency', + category: 'bot' +} \ No newline at end of file diff --git a/src/database.js b/src/database.js deleted file mode 100644 index 20016b5..0000000 --- a/src/database.js +++ /dev/null @@ -1,72 +0,0 @@ -import { resolve } from 'path'; -import { readFileSync, writeFileSync } from 'fs'; -class Database { - /** - * @param {string} dir - * @param {string} dataType - */ - constructor(dir, dataType) { - this._dataType = dataType; - this._content = dataType === 'array' ? [] : dataType === 'object' ? {} : undefined; - this._path = resolve(dir); - this._interval = undefined; - this._saveNotifs = true; - } - /** - * @param {string | number} data - * @param {any} data1 - */ - addData(data, data1) { - if (this._dataType === 'array') { - this._content.push(data); - } else if (this._dataType === 'object') { - this._content[data] = data1; - } - return this; - } - /** - * @param {string | number} key - */ - removeData(key) { - if (this._dataType === 'array') { - this._content.splice(key, 1); - } else if (this._dataType === 'object') { - delete this._content[key]; - } - return this; - } - initLoad() { - const json = readFileSync(this._path); - // @ts-ignore - const array = JSON.parse(json); - this._content = array; - console.log(this._path + ' Database Loaded'); - return this; - } - forceSave(db = this, force = false) { - const oldJson = readFileSync(db._path, { encoding: 'utf8' }); - const newJson = JSON.stringify(db._content); - if (oldJson !== newJson || force) { - writeFileSync(db._path, newJson); - if (this._saveNotifs) console.log(this._path + ' Database Saved'); - } - return db; - } - /** - * @param {any} milliseconds - */ - intervalSave(milliseconds) { - this._interval = setInterval(() => this.forceSave(this), milliseconds || 60000); - return this; - } - stopInterval() { - if (this._interval) clearInterval(this._interval); - return this; - } - disableSaveNotifs() { - this._saveNotifs = false; - console.log(this._path + ' "Database Saved" Notifications Disabled'); - return this; - } -} -export default Database; \ No newline at end of file diff --git a/src/database.ts b/src/database.ts new file mode 100644 index 0000000..7942b29 --- /dev/null +++ b/src/database.ts @@ -0,0 +1,69 @@ +import path from 'node:path'; +import { readFileSync, writeFileSync } from 'node:fs'; +import moment from 'moment'; +export class Database { + public _dataType: string; + public _path: string; + public _interval?: NodeJS.Timer; + public _saveNotifs: boolean; + public _content: any; + constructor(dir: string, dataType: string){ + this._dataType = dataType; + this._path = path.resolve(dir); + this._interval = undefined; + this._saveNotifs = true; + this._content = dataType === 'array' ? [] : {}; + } + addData(data: any, data1?: any){ + if (Array.isArray(this._content)){ + this._content.push(data); + } else if (typeof this._content === 'object'){ + this._content[data] = data1; + } + return this; + } + removeData(key: any, type: number, element: any){ + if (this._dataType === 'array'){ + switch (type){ + case 0: + this._content = this._content.filter((x:any)=>x != key); + break; + case 1: + this._content = this._content.filter((x:any)=>x[element] != key); + break; + default: + return 'Type must be properly specified'; + } + } else if (this._dataType === 'object'){ + delete this._content[key]; + } + return this; + } + initLoad(){ + this._content = JSON.parse(readFileSync(this._path, {encoding: 'utf8'})); + console.log(this._path + ' Database loaded'); + return this; + } + forceSave(db=this, force=false){ + const oldJson = readFileSync(db._path, {encoding: 'utf8'}); + const newJson = JSON.stringify(db._content); + if (oldJson !== newJson || force){ + writeFileSync(this._path, JSON.stringify(this._content, null, 2)); + if (this._saveNotifs) console.log(`\x1b[36m[${moment().format('DD/MM/YY HH:mm:ss')}] \x1b[33m` + this._path + ' Database saved'); + } + return db; + } + intervalSave(milliseconds?: number){ + this._interval = setInterval(()=>this.forceSave(this), milliseconds || 60000); + return this; + } + stopInterval(){ + if (this._interval) clearInterval(this._interval); + return this; + } + disableSaveNotifs(){ + this._saveNotifs = false; + console.log(this._path + ' "Database saved" Notifications disabled'); + return this; + } +} // Nice. \ No newline at end of file diff --git a/src/database/MPPlayerData.json b/src/database/MPPlayerData.json index 0637a08..fb6b921 100644 --- a/src/database/MPPlayerData.json +++ b/src/database/MPPlayerData.json @@ -1 +1 @@ -[] \ No newline at end of file +[1,2,3,4,5,6,6,6,6,6,6,6,6,6,6,6,5,5,5,5,4,4,3,3,4,5,4,4,4,4,4,4,4,4,3,3,3,3,4,4,4,4,4,4,4,4,4,4,5,5,5,5,4,4,4,4,4,4,4,4,4,4,4,4,4,4,5,4,4,4,4,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,2,2,2,2,2,2,2,2,3,3,3,3,4,4,5,5,5,5,5,5,5,5,5,4,4,4,3,3,3,3,3,3,3,3,3,3,3,3,3,3,4,3,3,3,3,4,4,4,4,4,4,4,4,4,4,4,4,4,5,5,5,5,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,5,5,5,4,4,4,4,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,2,2,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,2,2,2,2,0,0,0,2,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,4,5,5,5,5,6,6,5,5,5,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,4,4,4,4,4,4,4,4,4,4,4,4,4,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,4,4,4,4,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,1,1,1,2,2,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,4,4,6,6,5,5,5,5,5,5,7,6,6,7,7,7,7,7,8,7,8,8,8,8,8,8,8,9,9,9,9,9,10,9,9,9,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,6,5,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,5,5,5,6,6,6,6,6,6,6,6,5,5,4,3,3,3,3,0,0,0,0,0,0,0,0,0,0,1,1,1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,0,0,0,1,1,1,2,3,3,3,3,3,3,3,3,2,3,3,3,3,3,3,3,4,4,3,3,4,4,4,4,4,4,4,4,3,3,3,3,3,3,3,3,4,4,4,4,4,4,4,4,4,4,4,4,4,3,4,4,4,4,4,4,4,5,5,5,5,4,4,4,4,4,4,4,4,4,4,4,4,4,4,3,3,3,3,4,4,4,4,4,4,4,4,4,4,3,3,3,3,4,3,3,3,3,3,3,3,3,3,3,4,4,4,5,5,5,5,5,5,5,5,5,5,5,5,4,5,5,5,5,5,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,6,6,6,6,5,5,5,5,5,4,4,4,2,2,2,2,2,2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,2,2,2,2,2,2,2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,3,3,3,3,3,3,3,4,4,4,4,4,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,4,4,4,4,4,4,4,4,4,4,4,4,4,4,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,4,4,4,4,4,4,3,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,2,2,2,2,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,4,4,4,4,4,4,3,3,3,3,3,3,3,3,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,3,3,3,3,2,2,2,2,2,2,2,1,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,2,3,3,3,3,3,3,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,3,3,3,3,3,3,2,2,1,2,2,2,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,5,5,5,5,5,5,5,6,6,6,6,6,6,6,6,5,5,5,5,4,5,5,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,5,5,5,5,5,5,5,5,4,4,4,4,5,4,4,4,4,4,4,4,4,4,4,4,4,4,3,3,3,3,3,3,3,3,4,4,4,4,4,4,4,3,3,3,3,3,3,3,3,3,3,4,4,4,4,4,4,4,4,4,4,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,6,6,6,6,6,6,6,6,6,6,6,6,5,5,5,5,5,5,6,6,6,6,6,6,6,6,6,6,6,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,6,7,6,6,6,7,7,7,7,7,7,7,7,7,7,7,7,7] \ No newline at end of file diff --git a/src/database/bannedWords.json b/src/database/bannedWords.json index 0637a08..cbcb40e 100644 --- a/src/database/bannedWords.json +++ b/src/database/bannedWords.json @@ -1 +1 @@ -[] \ No newline at end of file +["fuck","fck","fů","fuk","fúck","fùck","fûck","fück","fūck","fůck","fűck","fùçk","fûćk","fucking","fųck","shit","shite","sht","shìt","shít","shît","shït","shīt","shįt","shıt","shlt","whore","pelotudo","boludo","nigger","nigga","nigs","niggas@","cunt","cnut","bitch","dick","pussy","asshole","b1tch","b!tch","blowjob","cock","c0ck","retard","fag","faggot","tits","boobs","dick","sex","porn","bjob","stfu","‎","­","͏","͏","؜","ᅟ","ᅠ","឴","឵","​","‏","‌","stfu","ass","kkk","<@1011334031478100099>","<@468835415093411861>","asf","af","wtf","piss","pissed","pissing"] \ No newline at end of file diff --git a/src/database/bonkCount.json b/src/database/bonkCount.json index 9e26dfe..57c7d84 100644 --- a/src/database/bonkCount.json +++ b/src/database/bonkCount.json @@ -1 +1 @@ -{} \ No newline at end of file +{"696085982201643090":3,"532662366354276352":2849,"178941218510602240":9,"615761944154210305":7,"141304507249197057":14,"190407856527376384":7,"711527768185372742":1,"716355511552966737":5,"593696856165449749":14,"824043915539513406":20,"771892617599516674":10,"889665445915926588":1,"488683638310043677":1027,"475037861725339649":1,"389237487094071337":1,"859313171964887140":1,"301350210926280704":2,"695323013813633076":2,"458688902102908928":2,"606595407769894995":1,"734703851558535188":2,"544215307972247553":2,"506022868157595648":1,"468837263577579524":3,"743212818467258468":1,"954092707213619221":1} \ No newline at end of file diff --git a/src/database/dailyMsgs.json b/src/database/dailyMsgs.json index 0637a08..120c04a 100644 --- a/src/database/dailyMsgs.json +++ b/src/database/dailyMsgs.json @@ -1 +1 @@ -[] \ No newline at end of file +[[0,674965],[1,675885],[2,676639],[3,677245],[4,677609],[5,678188],[6,678916],[7,679465],[8,679938],[9,680540],[10,681614],[11,682079],[12,682780],[13,683187],[14,683547],[15,683900],[16,684592],[17,685466],[18,686078],[19,686481],[20,676748],[21,676968],[22,677427],[23,677592],[24,677894],[25,678116],[26,676785],[27,677570],[28,678491],[29,679137],[30,679818],[31,680094],[32,680417],[33,680783],[34,681563],[35,682070],[36,682670],[37,683504],[38,684078],[39,684383],[40,684692],[41,685448],[42,685664],[43,685994],[44,686366],[45,687118],[46,687626],[47,688008],[48,688754],[49,688942],[50,689107],[51,689472],[52,690143],[53,690644],[54,691124],[55,692196],[56,692624],[57,692906],[58,693456],[59,693952],[60,694586],[61,695070],[62,696163],[63,696564],[64,697315],[65,698548],[66,699138],[67,699558],[68,700307],[69,701063],[70,701394],[71,701868],[72,702453],[73,702917],[76,705187],[77,705243],[78,705488],[79,705961],[80,706585],[81,707467],[82,708212]] \ No newline at end of file diff --git a/src/database/punishments.json b/src/database/punishments.json index 9e26dfe..5f73038 100644 --- a/src/database/punishments.json +++ b/src/database/punishments.json @@ -1 +1,98 @@ -{} \ No newline at end of file +[ + { + "type": "kick", + "id": 1, + "member": "1009270415241252864", + "moderator": "141304507249197057", + "time": 1662289354828, + "reason": "failing to change inappropriate \"about me\" section on multiple occasions" + }, + { + "type": "ban", + "id": 2, + "member": "991510617997443152", + "moderator": "190407856527376384", + "time": 1662485667322, + "reason": "compromised acc" + }, + { + "type": "warn", + "id": 3, + "member": "598995859388104784", + "moderator": "532662366354276352", + "time": 1662900975329, + "reason": "being rude to a moderator" + }, + { + "type": "ban", + "id": 4, + "member": "542134892327338035", + "moderator": "301350210926280704", + "time": 1663485351678, + "reason": "trying to post a discord link in multiple channels" + }, + { + "type": "warn", + "id": 5, + "member": "870330666187907132", + "moderator": "141304507249197057", + "time": 1663594515726, + "reason": "inappropriate reactions" + }, + { + "type": "ban", + "id": 6, + "member": "1030414094265761802", + "moderator": "141304507249197057", + "time": 1665779240168, + "reason": "cryptoscammer" + }, + { + "type": "warn", + "id": 7, + "member": "934366726282416168", + "moderator": "593696856165449749", + "time": 1667146446817, + "reason": "Trying to put DC invite links everywhere (PG Server)" + }, + { + "type": "kick", + "id": 8, + "member": "248226483967885312", + "moderator": "532662366354276352", + "time": 1667505431215, + "reason": "innapropiate pfp" + }, + { + "type": "kick", + "id": 9, + "member": "872074877039947778", + "moderator": "301350210926280704", + "time": 1667505683756, + "reason": "inappropriate name and pfp" + }, + { + "type": "ban", + "id": 10, + "member": "138377490132500480", + "moderator": "532662366354276352", + "time": 1668120578282, + "reason": "very innapropiate pfp" + }, + { + "type": "kick", + "id": 11, + "member": "502208091002109953", + "moderator": "301350210926280704", + "time": 1668123798741, + "reason": "inappropriate status and about me" + }, + { + "type": "kick", + "id": 12, + "member": "846431793715871749", + "moderator": "532662366354276352", + "time": 1668331244780, + "reason": "innapropiate profile picture" + } +] \ No newline at end of file diff --git a/src/database/userLevels.json b/src/database/userLevels.json index 9e26dfe..70fa847 100644 --- a/src/database/userLevels.json +++ b/src/database/userLevels.json @@ -1 +1,2682 @@ -{} \ No newline at end of file +{ + "190407856527376384": { + "messages": 52904, + "level": 59 + }, + "593696856165449749": { + "messages": 51257, + "level": 58 + }, + "141304507249197057": { + "messages": 67482, + "level": 67 + }, + "533707949831487488": { + "messages": 56765, + "level": 61 + }, + "532662366354276352": { + "messages": 33505, + "level": 47 + }, + "824043915539513406": { + "messages": 18398, + "level": 35 + }, + "178941218510602240": { + "messages": 6368, + "level": 20 + }, + "215497515934416896": { + "messages": 33121, + "level": 46 + }, + "301350210926280704": { + "messages": 14272, + "level": 30 + }, + "695323013813633076": { + "messages": 14063, + "level": 30 + }, + "389237487094071337": { + "messages": 12223, + "level": 28 + }, + "716355511552966737": { + "messages": 9115, + "level": 24 + }, + "633345781780185099": { + "messages": 29362, + "level": 44 + }, + "711527768185372742": { + "messages": 50172, + "level": 0 + }, + "832375940838326282": { + "messages": 7055, + "level": 0 + }, + "506022868157595648": { + "messages": 4943, + "level": 18 + }, + "458688902102908928": { + "messages": 6181, + "level": 20 + }, + "475037861725339649": { + "messages": 10096, + "level": 25 + }, + "392699530912727041": { + "messages": 4925, + "level": 18 + }, + "468837263577579524": { + "messages": 7565, + "level": 22 + }, + "734703851558535188": { + "messages": 20183, + "level": 36 + }, + "488683638310043677": { + "messages": 15456, + "level": 32 + }, + "606595407769894995": { + "messages": 23240, + "level": 39 + }, + "322835877027905547": { + "messages": 9999, + "level": 25 + }, + "485793265568841728": { + "messages": 37876, + "level": 50 + }, + "837979120142778388": { + "messages": 3636, + "level": 15 + }, + "509467946146332682": { + "messages": 15003, + "level": 0 + }, + "257954059988893720": { + "messages": 5391, + "level": 0 + }, + "690090143008555064": { + "messages": 9973, + "level": 25 + }, + "849633082440941628": { + "messages": 853, + "level": 0 + }, + "687720203773149238": { + "messages": 572, + "level": 0 + }, + "452576735494406175": { + "messages": 1675, + "level": 10 + }, + "763055599654666291": { + "messages": 969, + "level": 8 + }, + "623176215800446976": { + "messages": 581, + "level": 0 + }, + "366896479098372096": { + "messages": 2956, + "level": 14 + }, + "445940328634253323": { + "messages": 2039, + "level": 11 + }, + "769710040596217897": { + "messages": 439, + "level": 0 + }, + "169891949464125441": { + "messages": 516, + "level": 5 + }, + "718453763932946432": { + "messages": 13548, + "level": 30 + }, + "472809522226790420": { + "messages": 2773, + "level": 13 + }, + "763803832542035978": { + "messages": 678, + "level": 6 + }, + "931816463113814066": { + "messages": 672, + "level": 6 + }, + "958108557503524904": { + "messages": 376, + "level": 0 + }, + "771892617599516674": { + "messages": 621, + "level": 6 + }, + "468437000232501269": { + "messages": 3632, + "level": 15 + }, + "859313171964887140": { + "messages": 1262, + "level": 9 + }, + "666185220046848021": { + "messages": 766, + "level": 0 + }, + "309373272594579456": { + "messages": 3582, + "level": 15 + }, + "399625244588900362": { + "messages": 21298, + "level": 37 + }, + "889665445915926588": { + "messages": 357, + "level": 0 + }, + "615761944154210305": { + "messages": 2924, + "level": 13 + }, + "397101726047666197": { + "messages": 5553, + "level": 0 + }, + "402555307789910028": { + "messages": 105, + "level": 2 + }, + "857011465060220960": { + "messages": 2, + "level": 0 + }, + "820029314103246860": { + "messages": 19, + "level": 1 + }, + "831633702492307473": { + "messages": 7, + "level": 0 + }, + "528003225375473674": { + "messages": 79, + "level": 2 + }, + "645342896312156181": { + "messages": 662, + "level": 6 + }, + "488505753133645826": { + "messages": 10, + "level": 0 + }, + "313461397457600512": { + "messages": 77, + "level": 2 + }, + "848489550065827850": { + "messages": 40, + "level": 1 + }, + "862138850423472128": { + "messages": 51, + "level": 1 + }, + "700053257996992573": { + "messages": 75, + "level": 2 + }, + "949404588673482872": { + "messages": 1, + "level": 0 + }, + "820038698186833992": { + "messages": 12, + "level": 0 + }, + "997846440887984139": { + "messages": 1, + "level": 0 + }, + "617353338324779008": { + "messages": 173, + "level": 3 + }, + "983545546348318771": { + "messages": 36, + "level": 1 + }, + "771433946890108989": { + "messages": 21, + "level": 0 + }, + "847575717369872384": { + "messages": 10, + "level": 0 + }, + "509374532109336576": { + "messages": 27, + "level": 1 + }, + "464887328138199042": { + "messages": 51, + "level": 1 + }, + "320650417526538241": { + "messages": 1, + "level": 0 + }, + "283864360697331713": { + "messages": 55, + "level": 1 + }, + "481056143536553984": { + "messages": 66, + "level": 2 + }, + "813156260563910696": { + "messages": 25, + "level": 1 + }, + "236902492955344898": { + "messages": 9, + "level": 0 + }, + "994209361620639817": { + "messages": 3, + "level": 0 + }, + "908738207305310228": { + "messages": 2, + "level": 0 + }, + "929785471607902291": { + "messages": 6, + "level": 0 + }, + "990535513817620490": { + "messages": 4, + "level": 0 + }, + "537070168715690026": { + "messages": 1, + "level": 0 + }, + "533753702863994900": { + "messages": 7, + "level": 0 + }, + "544632628045807626": { + "messages": 1, + "level": 0 + }, + "929408228255731713": { + "messages": 34, + "level": 1 + }, + "810517881392988220": { + "messages": 27, + "level": 1 + }, + "132183685658050561": { + "messages": 8, + "level": 0 + }, + "549295707304099846": { + "messages": 44, + "level": 1 + }, + "759390179064283178": { + "messages": 2, + "level": 0 + }, + "225333652194590721": { + "messages": 4, + "level": 0 + }, + "879462110529216512": { + "messages": 40, + "level": 0 + }, + "724306941458907156": { + "messages": 2, + "level": 0 + }, + "728486240818823210": { + "messages": 69, + "level": 0 + }, + "837811093010645033": { + "messages": 5, + "level": 0 + }, + "897195440460693585": { + "messages": 4, + "level": 0 + }, + "904315572563623958": { + "messages": 20, + "level": 0 + }, + "853387631500722217": { + "messages": 8, + "level": 0 + }, + "285724781188481025": { + "messages": 2, + "level": 0 + }, + "706902103305617498": { + "messages": 4, + "level": 0 + }, + "932929830775840808": { + "messages": 2, + "level": 0 + }, + "903147621961588757": { + "messages": 13, + "level": 0 + }, + "386627658773168137": { + "messages": 2, + "level": 0 + }, + "903303823358042152": { + "messages": 1, + "level": 0 + }, + "1011604280379195412": { + "messages": 2, + "level": 0 + }, + "774337023804833825": { + "messages": 81, + "level": 0 + }, + "700434438890323990": { + "messages": 9, + "level": 0 + }, + "281518331427553280": { + "messages": 26, + "level": 1 + }, + "708758234407895050": { + "messages": 11, + "level": 0 + }, + "359390542812938241": { + "messages": 7, + "level": 0 + }, + "782285256145371137": { + "messages": 4, + "level": 0 + }, + "747338155006361670": { + "messages": 1, + "level": 0 + }, + "440161021483679746": { + "messages": 69, + "level": 2 + }, + "887393494719660064": { + "messages": 6, + "level": 0 + }, + "693299576710365235": { + "messages": 23, + "level": 0 + }, + "621354246452805633": { + "messages": 58, + "level": 0 + }, + "724352571333935154": { + "messages": 7, + "level": 0 + }, + "769910225900797982": { + "messages": 2, + "level": 0 + }, + "780144472402034698": { + "messages": 11, + "level": 0 + }, + "557611382028369921": { + "messages": 50, + "level": 0 + }, + "587649354811179011": { + "messages": 1, + "level": 0 + }, + "871860791408726046": { + "messages": 14, + "level": 0 + }, + "780130996522844240": { + "messages": 7, + "level": 0 + }, + "834893094083362878": { + "messages": 6, + "level": 0 + }, + "870322903160332348": { + "messages": 4, + "level": 0 + }, + "697749263471476746": { + "messages": 4, + "level": 0 + }, + "367051844004085780": { + "messages": 5, + "level": 0 + }, + "414413764931354624": { + "messages": 23, + "level": 0 + }, + "611055992121327617": { + "messages": 2, + "level": 0 + }, + "522208923688632322": { + "messages": 2, + "level": 0 + }, + "660117183699091506": { + "messages": 9, + "level": 0 + }, + "634416842152345630": { + "messages": 7, + "level": 0 + }, + "909106645341196299": { + "messages": 6, + "level": 0 + }, + "398164488077180938": { + "messages": 8, + "level": 0 + }, + "818595993121062974": { + "messages": 45, + "level": 1 + }, + "273755695680192513": { + "messages": 4, + "level": 0 + }, + "249231429316116480": { + "messages": 1, + "level": 0 + }, + "869718328313278555": { + "messages": 87, + "level": 2 + }, + "772197160372404234": { + "messages": 2, + "level": 0 + }, + "485340808539799553": { + "messages": 5, + "level": 0 + }, + "676167254055976970": { + "messages": 1, + "level": 0 + }, + "987844984596222002": { + "messages": 2, + "level": 0 + }, + "705189525743206460": { + "messages": 13, + "level": 0 + }, + "1007746635377410110": { + "messages": 2, + "level": 0 + }, + "913459811067240548": { + "messages": 3, + "level": 0 + }, + "820416103497859103": { + "messages": 39, + "level": 0 + }, + "685946085038227456": { + "messages": 21, + "level": 0 + }, + "648887748396187648": { + "messages": 3, + "level": 0 + }, + "684834379993972742": { + "messages": 22, + "level": 0 + }, + "727566015143346186": { + "messages": 12, + "level": 0 + }, + "207709520317775872": { + "messages": 13, + "level": 0 + }, + "903667091784228955": { + "messages": 5, + "level": 0 + }, + "686756238197129234": { + "messages": 7, + "level": 0 + }, + "613772585959686178": { + "messages": 2, + "level": 0 + }, + "934382941348442153": { + "messages": 9, + "level": 0 + }, + "484817180551282688": { + "messages": 3, + "level": 0 + }, + "934135359619600455": { + "messages": 38, + "level": 0 + }, + "671164802957180940": { + "messages": 2, + "level": 0 + }, + "838224327047381042": { + "messages": 2, + "level": 0 + }, + "710528208273145967": { + "messages": 1, + "level": 0 + }, + "280115935057281024": { + "messages": 1, + "level": 0 + }, + "595727217271635969": { + "messages": 40, + "level": 0 + }, + "732302051517923438": { + "messages": 2, + "level": 0 + }, + "772958110092230668": { + "messages": 3, + "level": 0 + }, + "739960771038937099": { + "messages": 3, + "level": 0 + }, + "188304766923833344": { + "messages": 20, + "level": 1 + }, + "749311773819142326": { + "messages": 2, + "level": 0 + }, + "918215002559758377": { + "messages": 18, + "level": 0 + }, + "730790083501883442": { + "messages": 41, + "level": 1 + }, + "673950857238413362": { + "messages": 12, + "level": 0 + }, + "434344693824749568": { + "messages": 3, + "level": 0 + }, + "877581891379818517": { + "messages": 4, + "level": 0 + }, + "668496807655112705": { + "messages": 1, + "level": 0 + }, + "1015580235443490836": { + "messages": 1, + "level": 0 + }, + "916652796277817374": { + "messages": 12, + "level": 0 + }, + "442785861998870529": { + "messages": 45, + "level": 0 + }, + "265901207296540672": { + "messages": 1, + "level": 0 + }, + "174851371114168320": { + "messages": 18, + "level": 1 + }, + "1014266691661877330": { + "messages": 3, + "level": 0 + }, + "493045512480751626": { + "messages": 18, + "level": 1 + }, + "475058155903123467": { + "messages": 3, + "level": 0 + }, + "971380069698269194": { + "messages": 1, + "level": 0 + }, + "909009499401093141": { + "messages": 2, + "level": 0 + }, + "759825692463464559": { + "messages": 15, + "level": 0 + }, + "710043061660680203": { + "messages": 2, + "level": 0 + }, + "1006109266316374046": { + "messages": 5, + "level": 0 + }, + "792095831587160104": { + "messages": 4, + "level": 0 + }, + "414462604216500224": { + "messages": 2, + "level": 0 + }, + "647790989078954004": { + "messages": 8, + "level": 0 + }, + "430683330996994048": { + "messages": 3, + "level": 0 + }, + "281559923702366218": { + "messages": 12, + "level": 0 + }, + "954075037315510363": { + "messages": 2, + "level": 0 + }, + "598995859388104784": { + "messages": 34, + "level": 0 + }, + "552473047144071168": { + "messages": 19, + "level": 0 + }, + "587377817893994538": { + "messages": 1, + "level": 0 + }, + "916695915736207381": { + "messages": 20, + "level": 1 + }, + "457390648568315904": { + "messages": 5, + "level": 0 + }, + "226834787103408139": { + "messages": 6, + "level": 0 + }, + "765860638617632788": { + "messages": 14, + "level": 0 + }, + "698428165445517356": { + "messages": 23, + "level": 1 + }, + "940617130703990864": { + "messages": 3, + "level": 0 + }, + "899010741552676956": { + "messages": 2, + "level": 0 + }, + "315203213739556864": { + "messages": 2, + "level": 0 + }, + "399342507655299072": { + "messages": 2, + "level": 0 + }, + "1016733059808235682": { + "messages": 15, + "level": 0 + }, + "369123847347240960": { + "messages": 38, + "level": 0 + }, + "531238170730299422": { + "messages": 1, + "level": 0 + }, + "513009978315898891": { + "messages": 10, + "level": 0 + }, + "667815332047486978": { + "messages": 1, + "level": 0 + }, + "902243585511026738": { + "messages": 3, + "level": 0 + }, + "645025848134729741": { + "messages": 8, + "level": 0 + }, + "850692577405304842": { + "messages": 1, + "level": 0 + }, + "832131556344594502": { + "messages": 17, + "level": 0 + }, + "684598111540346948": { + "messages": 1, + "level": 0 + }, + "391052170469965845": { + "messages": 2, + "level": 0 + }, + "1017349681711419412": { + "messages": 9, + "level": 0 + }, + "941687783876091954": { + "messages": 3, + "level": 0 + }, + "417748434888687616": { + "messages": 6, + "level": 0 + }, + "796380882377900072": { + "messages": 1, + "level": 0 + }, + "613447153632935979": { + "messages": 3, + "level": 0 + }, + "701494146405236816": { + "messages": 1, + "level": 0 + }, + "299942833564155904": { + "messages": 1, + "level": 0 + }, + "814428163660316673": { + "messages": 11, + "level": 0 + }, + "209414694392299521": { + "messages": 1, + "level": 0 + }, + "246804586126508032": { + "messages": 18, + "level": 0 + }, + "879811743818330164": { + "messages": 5, + "level": 0 + }, + "610084537052954645": { + "messages": 4, + "level": 0 + }, + "298505558326116353": { + "messages": 1, + "level": 0 + }, + "357215847259045891": { + "messages": 2, + "level": 0 + }, + "967750493067673670": { + "messages": 7, + "level": 0 + }, + "409702338580709386": { + "messages": 1, + "level": 0 + }, + "403178207752486914": { + "messages": 2, + "level": 0 + }, + "824591206273122314": { + "messages": 1, + "level": 0 + }, + "795283445806399498": { + "messages": 1, + "level": 0 + }, + "862351520753123330": { + "messages": 11, + "level": 0 + }, + "482954029001867264": { + "messages": 2, + "level": 0 + }, + "713408925231481006": { + "messages": 2, + "level": 0 + }, + "366649062554075137": { + "messages": 8, + "level": 0 + }, + "914070233180950539": { + "messages": 1, + "level": 0 + }, + "806390937864372224": { + "messages": 1, + "level": 0 + }, + "553529202834669580": { + "messages": 3, + "level": 0 + }, + "910955711033376829": { + "messages": 12, + "level": 0 + }, + "733045001851764896": { + "messages": 7, + "level": 0 + }, + "315526513187487744": { + "messages": 2, + "level": 0 + }, + "707867907429892108": { + "messages": 106, + "level": 0 + }, + "787287585290453084": { + "messages": 3, + "level": 0 + }, + "973881103565877318": { + "messages": 1, + "level": 0 + }, + "502048452323049472": { + "messages": 2, + "level": 0 + }, + "925853783915888682": { + "messages": 1, + "level": 0 + }, + "682424368936124434": { + "messages": 2, + "level": 0 + }, + "829404033949106190": { + "messages": 14, + "level": 0 + }, + "695328592837607504": { + "messages": 7, + "level": 0 + }, + "318812158332764170": { + "messages": 3, + "level": 0 + }, + "405785927877918723": { + "messages": 1, + "level": 0 + }, + "799408177745494069": { + "messages": 2, + "level": 0 + }, + "599775074433892373": { + "messages": 1, + "level": 0 + }, + "965815934960951306": { + "messages": 2, + "level": 0 + }, + "521251924327006208": { + "messages": 2, + "level": 0 + }, + "541365169167794177": { + "messages": 2, + "level": 0 + }, + "544215307972247553": { + "messages": 41, + "level": 0 + }, + "868930170805944340": { + "messages": 18, + "level": 0 + }, + "170640163398090762": { + "messages": 2, + "level": 0 + }, + "455423861362655252": { + "messages": 1, + "level": 0 + }, + "760579326344691762": { + "messages": 3, + "level": 0 + }, + "890652692718977035": { + "messages": 2, + "level": 0 + }, + "781289786143932499": { + "messages": 105, + "level": 0 + }, + "348617165135544321": { + "messages": 1, + "level": 0 + }, + "268494595594256386": { + "messages": 4, + "level": 0 + }, + "120971157158625280": { + "messages": 1, + "level": 0 + }, + "659804799595839517": { + "messages": 2, + "level": 0 + }, + "168118004922449920": { + "messages": 1, + "level": 0 + }, + "576898553591627812": { + "messages": 3, + "level": 0 + }, + "594338298894483486": { + "messages": 1, + "level": 0 + }, + "772056403925008395": { + "messages": 9, + "level": 0 + }, + "457280461471744013": { + "messages": 3, + "level": 0 + }, + "930145722110726216": { + "messages": 9, + "level": 0 + }, + "858455916714131517": { + "messages": 4, + "level": 0 + }, + "920391703070924801": { + "messages": 3, + "level": 0 + }, + "412304646858604555": { + "messages": 29, + "level": 1 + }, + "118750182111182850": { + "messages": 4, + "level": 0 + }, + "737566047019728908": { + "messages": 3, + "level": 0 + }, + "184941472615759872": { + "messages": 3, + "level": 0 + }, + "642735886953611265": { + "messages": 1, + "level": 0 + }, + "691754622330601574": { + "messages": 2, + "level": 0 + }, + "754849790096834603": { + "messages": 34, + "level": 1 + }, + "365571588676124693": { + "messages": 1, + "level": 0 + }, + "249190995542016011": { + "messages": 2, + "level": 0 + }, + "438531245215973376": { + "messages": 1, + "level": 0 + }, + "979639503117512736": { + "messages": 1, + "level": 0 + }, + "681470305574584321": { + "messages": 40, + "level": 0 + }, + "474968759132618764": { + "messages": 2, + "level": 0 + }, + "911002690501353512": { + "messages": 1, + "level": 0 + }, + "427008359019970562": { + "messages": 26, + "level": 0 + }, + "772756530416189440": { + "messages": 40, + "level": 0 + }, + "339498146608709634": { + "messages": 6, + "level": 0 + }, + "897183738608369674": { + "messages": 2, + "level": 0 + }, + "631426982961348639": { + "messages": 1, + "level": 0 + }, + "342516384141672449": { + "messages": 3, + "level": 0 + }, + "222365262748319744": { + "messages": 1, + "level": 0 + }, + "302267580037464064": { + "messages": 2, + "level": 0 + }, + "481189706063675393": { + "messages": 8, + "level": 0 + }, + "382391571280166912": { + "messages": 1, + "level": 0 + }, + "820681721048989736": { + "messages": 5, + "level": 0 + }, + "701551279394259024": { + "messages": 8, + "level": 0 + }, + "1022589415127777404": { + "messages": 14, + "level": 0 + }, + "291487254470459392": { + "messages": 2, + "level": 0 + }, + "323371916897419265": { + "messages": 1, + "level": 0 + }, + "285033765175164929": { + "messages": 1, + "level": 0 + }, + "242050545798479875": { + "messages": 10, + "level": 0 + }, + "1021166241018298378": { + "messages": 2, + "level": 0 + }, + "444415772001959936": { + "messages": 14, + "level": 0 + }, + "629585796290314250": { + "messages": 103, + "level": 0 + }, + "828626078498816020": { + "messages": 24, + "level": 0 + }, + "682868018568757269": { + "messages": 1, + "level": 0 + }, + "701146951390855288": { + "messages": 16, + "level": 0 + }, + "775080846159118378": { + "messages": 4, + "level": 0 + }, + "255798101099413506": { + "messages": 5, + "level": 0 + }, + "750064203213307905": { + "messages": 2, + "level": 0 + }, + "631673794783870986": { + "messages": 1, + "level": 0 + }, + "404552176732471296": { + "messages": 3, + "level": 0 + }, + "359429292352077826": { + "messages": 130, + "level": 2 + }, + "447069071230500884": { + "messages": 3, + "level": 0 + }, + "698617839132868758": { + "messages": 1, + "level": 0 + }, + "837396359173636106": { + "messages": 20, + "level": 0 + }, + "985490601665503292": { + "messages": 3, + "level": 0 + }, + "470147904133136405": { + "messages": 1, + "level": 0 + }, + "693242995264323587": { + "messages": 1, + "level": 0 + }, + "732369728101941319": { + "messages": 2, + "level": 0 + }, + "555500484325146647": { + "messages": 1, + "level": 0 + }, + "628155241509945364": { + "messages": 1, + "level": 0 + }, + "962627583239913542": { + "messages": 8, + "level": 0 + }, + "486352184707907585": { + "messages": 3, + "level": 0 + }, + "309170189164085249": { + "messages": 6, + "level": 0 + }, + "699279178322935859": { + "messages": 3, + "level": 0 + }, + "874160640862847006": { + "messages": 3, + "level": 0 + }, + "478243224469766144": { + "messages": 1, + "level": 0 + }, + "425065519360507904": { + "messages": 20, + "level": 0 + }, + "777140905425108993": { + "messages": 3, + "level": 0 + }, + "98464148379148288": { + "messages": 1358, + "level": 9 + }, + "1025723411680460840": { + "messages": 1, + "level": 0 + }, + "892797492402470923": { + "messages": 15, + "level": 0 + }, + "329457560455348229": { + "messages": 4, + "level": 0 + }, + "420650725597511690": { + "messages": 4, + "level": 0 + }, + "729246256932716627": { + "messages": 2, + "level": 0 + }, + "673588616575975433": { + "messages": 1, + "level": 0 + }, + "701467914473308260": { + "messages": 38, + "level": 0 + }, + "786733440003211285": { + "messages": 15, + "level": 1 + }, + "853043920505012255": { + "messages": 81, + "level": 0 + }, + "164097668388356097": { + "messages": 1, + "level": 0 + }, + "647067529952624651": { + "messages": 2, + "level": 0 + }, + "564266539528880169": { + "messages": 7, + "level": 0 + }, + "648866806370664459": { + "messages": 1, + "level": 0 + }, + "501039274821681184": { + "messages": 1, + "level": 0 + }, + "543227641369591820": { + "messages": 3, + "level": 0 + }, + "849691883966169094": { + "messages": 2, + "level": 0 + }, + "714941772836503593": { + "messages": 17, + "level": 0 + }, + "736609415980908596": { + "messages": 18, + "level": 0 + }, + "801567218357895170": { + "messages": 1, + "level": 0 + }, + "525769063553695795": { + "messages": 2, + "level": 0 + }, + "1028204452328517703": { + "messages": 67, + "level": 2 + }, + "179671371931058176": { + "messages": 11, + "level": 0 + }, + "317587680483606528": { + "messages": 3, + "level": 0 + }, + "761606676066730006": { + "messages": 2, + "level": 0 + }, + "973645817741201412": { + "messages": 1, + "level": 0 + }, + "541744830380900362": { + "messages": 1, + "level": 0 + }, + "614558625285013530": { + "messages": 1, + "level": 0 + }, + "200347504674471937": { + "messages": 2, + "level": 0 + }, + "259302339737812993": { + "messages": 1, + "level": 0 + }, + "207828776262828034": { + "messages": 5, + "level": 0 + }, + "819948487588184125": { + "messages": 2, + "level": 0 + }, + "242736079600484359": { + "messages": 1, + "level": 0 + }, + "889624632724963329": { + "messages": 35, + "level": 1 + }, + "687692546314600530": { + "messages": 1, + "level": 0 + }, + "909059367364620349": { + "messages": 2, + "level": 0 + }, + "221033862526926848": { + "messages": 1, + "level": 0 + }, + "539368454436814858": { + "messages": 1, + "level": 0 + }, + "939589966395244625": { + "messages": 14, + "level": 0 + }, + "861322026643226624": { + "messages": 3, + "level": 0 + }, + "239097398553477121": { + "messages": 2, + "level": 0 + }, + "203467499377917953": { + "messages": 1, + "level": 0 + }, + "986960498195038208": { + "messages": 2, + "level": 0 + }, + "515860794013909005": { + "messages": 15, + "level": 0 + }, + "289779411446661120": { + "messages": 1, + "level": 0 + }, + "999302732232007731": { + "messages": 6, + "level": 0 + }, + "565752202719789056": { + "messages": 12, + "level": 0 + }, + "953668147838332998": { + "messages": 22, + "level": 0 + }, + "777917870197440522": { + "messages": 8, + "level": 0 + }, + "379593697718829056": { + "messages": 5, + "level": 0 + }, + "696267371643404349": { + "messages": 21, + "level": 0 + }, + "757650142777311233": { + "messages": 10, + "level": 0 + }, + "810697699715186708": { + "messages": 5, + "level": 0 + }, + "978394490643554464": { + "messages": 3, + "level": 0 + }, + "131799808502398976": { + "messages": 26, + "level": 0 + }, + "1018003331890810990": { + "messages": 12, + "level": 0 + }, + "999815021301334147": { + "messages": 4, + "level": 0 + }, + "712251385495814165": { + "messages": 4, + "level": 0 + }, + "922822659232894976": { + "messages": 2, + "level": 0 + }, + "337958469875400706": { + "messages": 1, + "level": 0 + }, + "544143568789307397": { + "messages": 8, + "level": 0 + }, + "300400746401366016": { + "messages": 4, + "level": 0 + }, + "631101973118058536": { + "messages": 2, + "level": 0 + }, + "1012749745904685108": { + "messages": 16, + "level": 0 + }, + "926473543397568552": { + "messages": 1, + "level": 0 + }, + "306234177404272640": { + "messages": 32, + "level": 0 + }, + "602538366831034368": { + "messages": 2, + "level": 0 + }, + "202203013077663745": { + "messages": 1, + "level": 0 + }, + "397360804510302219": { + "messages": 3, + "level": 0 + }, + "792098245441486859": { + "messages": 68, + "level": 2 + }, + "544435655070056448": { + "messages": 2, + "level": 0 + }, + "635240216570888217": { + "messages": 7, + "level": 0 + }, + "660064913556897792": { + "messages": 2, + "level": 0 + }, + "792403251101564968": { + "messages": 2, + "level": 0 + }, + "1008787007494963220": { + "messages": 6, + "level": 0 + }, + "681183477978497045": { + "messages": 2, + "level": 0 + }, + "940385951593685003": { + "messages": 2, + "level": 0 + }, + "896771905581875200": { + "messages": 17, + "level": 0 + }, + "559021044627800068": { + "messages": 26, + "level": 0 + }, + "937750032344571934": { + "messages": 96, + "level": 2 + }, + "873149038709571594": { + "messages": 2, + "level": 0 + }, + "999505701472833627": { + "messages": 2, + "level": 0 + }, + "730608210163269684": { + "messages": 5, + "level": 0 + }, + "944695297408381048": { + "messages": 14, + "level": 0 + }, + "787003474163662870": { + "messages": 13, + "level": 0 + }, + "712368098518237202": { + "messages": 1, + "level": 0 + }, + "633339908827643974": { + "messages": 12, + "level": 0 + }, + "174267277187874816": { + "messages": 22, + "level": 0 + }, + "890726227999080520": { + "messages": 1, + "level": 0 + }, + "983348912498806864": { + "messages": 1, + "level": 0 + }, + "1031203432029245540": { + "messages": 3, + "level": 0 + }, + "825286490828701699": { + "messages": 3, + "level": 0 + }, + "877631827337150615": { + "messages": 25, + "level": 1 + }, + "1008344961848180797": { + "messages": 2, + "level": 0 + }, + "947741928072556575": { + "messages": 2, + "level": 0 + }, + "866099118559461376": { + "messages": 5, + "level": 0 + }, + "796040852400635914": { + "messages": 314, + "level": 4 + }, + "1011307308325818438": { + "messages": 23, + "level": 0 + }, + "761645705692971039": { + "messages": 3, + "level": 0 + }, + "661959622751682570": { + "messages": 8, + "level": 0 + }, + "673289306424475659": { + "messages": 103, + "level": 2 + }, + "907163452043305000": { + "messages": 26, + "level": 0 + }, + "485198924563611651": { + "messages": 3, + "level": 0 + }, + "759513975397679135": { + "messages": 4, + "level": 0 + }, + "882271853748563978": { + "messages": 4, + "level": 0 + }, + "432656092041052161": { + "messages": 1, + "level": 0 + }, + "992504968768651325": { + "messages": 1, + "level": 0 + }, + "345660357475565568": { + "messages": 2, + "level": 0 + }, + "541283174945259541": { + "messages": 14, + "level": 0 + }, + "790552696973033513": { + "messages": 8, + "level": 0 + }, + "854209349961384006": { + "messages": 12, + "level": 0 + }, + "945971029216485417": { + "messages": 4, + "level": 0 + }, + "1031511525967548477": { + "messages": 15, + "level": 0 + }, + "428303560044707858": { + "messages": 1, + "level": 0 + }, + "832427695505276928": { + "messages": 7, + "level": 0 + }, + "586590703652569101": { + "messages": 2, + "level": 0 + }, + "1003354962392273048": { + "messages": 8, + "level": 0 + }, + "1031624722934415451": { + "messages": 11, + "level": 0 + }, + "783442257575542876": { + "messages": 7, + "level": 0 + }, + "928342777845145692": { + "messages": 1, + "level": 0 + }, + "497463102376378370": { + "messages": 6, + "level": 0 + }, + "335637071878422529": { + "messages": 98, + "level": 2 + }, + "646684489573203968": { + "messages": 3, + "level": 0 + }, + "481172729031032865": { + "messages": 1, + "level": 0 + }, + "774803463107379212": { + "messages": 4, + "level": 0 + }, + "682165767109738507": { + "messages": 103, + "level": 0 + }, + "127840266701766656": { + "messages": 6, + "level": 0 + }, + "396778041470222349": { + "messages": 98, + "level": 2 + }, + "967849095379189861": { + "messages": 1, + "level": 0 + }, + "1031950921233600662": { + "messages": 14, + "level": 0 + }, + "907951346769092618": { + "messages": 3, + "level": 0 + }, + "1031635379750711316": { + "messages": 43, + "level": 0 + }, + "927399246905372743": { + "messages": 2, + "level": 0 + }, + "386722808882921484": { + "messages": 5, + "level": 0 + }, + "799128650145333289": { + "messages": 18, + "level": 0 + }, + "948635048222027777": { + "messages": 26, + "level": 0 + }, + "335506215239155712": { + "messages": 19, + "level": 0 + }, + "760933373840851005": { + "messages": 2, + "level": 0 + }, + "269080252737781770": { + "messages": 2, + "level": 0 + }, + "764917794545336350": { + "messages": 1, + "level": 0 + }, + "386467425702641665": { + "messages": 1, + "level": 0 + }, + "429926807333109771": { + "messages": 2, + "level": 0 + }, + "906951985306157128": { + "messages": 1, + "level": 0 + }, + "421138045245325332": { + "messages": 2, + "level": 0 + }, + "442254870666280961": { + "messages": 40, + "level": 0 + }, + "695565302187950110": { + "messages": 2, + "level": 0 + }, + "813866707365265419": { + "messages": 100, + "level": 0 + }, + "726188513518813275": { + "messages": 1, + "level": 0 + }, + "899434910014664734": { + "messages": 2, + "level": 0 + }, + "893300170752655401": { + "messages": 2, + "level": 0 + }, + "211142651343273985": { + "messages": 1, + "level": 0 + }, + "715615331938467962": { + "messages": 8, + "level": 0 + }, + "1033047374597214298": { + "messages": 4, + "level": 0 + }, + "525724999173144576": { + "messages": 1, + "level": 0 + }, + "776384425827106858": { + "messages": 8, + "level": 0 + }, + "690129851004354602": { + "messages": 1, + "level": 0 + }, + "1011402542418247820": { + "messages": 1, + "level": 0 + }, + "1030526730462572558": { + "messages": 189, + "level": 3 + }, + "530533266206359552": { + "messages": 17, + "level": 0 + }, + "479291578352140298": { + "messages": 1, + "level": 0 + }, + "889408189987192863": { + "messages": 7, + "level": 0 + }, + "493978248993308705": { + "messages": 2, + "level": 0 + }, + "792177508854136842": { + "messages": 13, + "level": 0 + }, + "306214308981768193": { + "messages": 1, + "level": 0 + }, + "278935400519565312": { + "messages": 1, + "level": 0 + }, + "772043001702645822": { + "messages": 3, + "level": 0 + }, + "269536385915027456": { + "messages": 4, + "level": 0 + }, + "698842868835549224": { + "messages": 34, + "level": 0 + }, + "905139657778532393": { + "messages": 2, + "level": 0 + }, + "820674035414728714": { + "messages": 12, + "level": 0 + }, + "483648733330800647": { + "messages": 2, + "level": 0 + }, + "297087556116414465": { + "messages": 17, + "level": 1 + }, + "442373422975156235": { + "messages": 1, + "level": 0 + }, + "690266344351858708": { + "messages": 5, + "level": 0 + }, + "273183233674444801": { + "messages": 1, + "level": 0 + }, + "745931688005206098": { + "messages": 2, + "level": 0 + }, + "1025469687754145842": { + "messages": 5, + "level": 0 + }, + "1023915974690340946": { + "messages": 17, + "level": 1 + }, + "871113268633174128": { + "messages": 2, + "level": 0 + }, + "1012067570666447050": { + "messages": 1, + "level": 0 + }, + "760179188039811114": { + "messages": 1, + "level": 0 + }, + "630700296674344972": { + "messages": 1, + "level": 0 + }, + "405680875242651648": { + "messages": 1, + "level": 0 + }, + "919656602645168138": { + "messages": 1, + "level": 0 + }, + "533708899614720007": { + "messages": 1, + "level": 0 + }, + "978394364038492200": { + "messages": 2, + "level": 0 + }, + "916719320057397308": { + "messages": 2, + "level": 0 + }, + "193188294568181760": { + "messages": 4, + "level": 0 + }, + "123080080946757632": { + "messages": 14, + "level": 0 + }, + "1001530115148226711": { + "messages": 1, + "level": 0 + }, + "975008344895021076": { + "messages": 1, + "level": 0 + }, + "189103401508798465": { + "messages": 5, + "level": 0 + }, + "607244126496358457": { + "messages": 6, + "level": 0 + }, + "719634875052851220": { + "messages": 2, + "level": 0 + }, + "643866761183232022": { + "messages": 2, + "level": 0 + }, + "969867332304400404": { + "messages": 4, + "level": 0 + }, + "881867367418826812": { + "messages": 1, + "level": 0 + }, + "940973619603968050": { + "messages": 4, + "level": 0 + }, + "896159746283933806": { + "messages": 20, + "level": 0 + }, + "495639721666412545": { + "messages": 3, + "level": 0 + }, + "119192516649025536": { + "messages": 14, + "level": 0 + }, + "980394588806217798": { + "messages": 1, + "level": 0 + }, + "731709896978071614": { + "messages": 4, + "level": 0 + }, + "1015867254115663902": { + "messages": 1, + "level": 0 + }, + "832300139196055633": { + "messages": 1, + "level": 0 + }, + "702500283162558538": { + "messages": 1, + "level": 0 + }, + "787081270475096084": { + "messages": 78, + "level": 0 + }, + "1035210998321258586": { + "messages": 4, + "level": 0 + }, + "91239202699644928": { + "messages": 7, + "level": 0 + }, + "274446019423502338": { + "messages": 1, + "level": 0 + }, + "777616375291052044": { + "messages": 3, + "level": 0 + }, + "507755015524581376": { + "messages": 1, + "level": 0 + }, + "611550322535563264": { + "messages": 8, + "level": 0 + }, + "709694111975997460": { + "messages": 4, + "level": 0 + }, + "673734390786031636": { + "messages": 10, + "level": 0 + }, + "866316833065795595": { + "messages": 1, + "level": 0 + }, + "833145918987173959": { + "messages": 1, + "level": 0 + }, + "923363041788170290": { + "messages": 1, + "level": 0 + }, + "582440916632076298": { + "messages": 18, + "level": 0 + }, + "896852966345158712": { + "messages": 14, + "level": 0 + }, + "459283924510834698": { + "messages": 5, + "level": 0 + }, + "908019134011428894": { + "messages": 2, + "level": 0 + }, + "591972887812898816": { + "messages": 1, + "level": 0 + }, + "718100655851438090": { + "messages": 2, + "level": 0 + }, + "334743125132181505": { + "messages": 1, + "level": 0 + }, + "1036085806793768960": { + "messages": 1, + "level": 0 + }, + "688874573566836771": { + "messages": 1, + "level": 0 + }, + "450956252785147913": { + "messages": 2, + "level": 0 + }, + "782568086657171466": { + "messages": 9, + "level": 0 + }, + "792136164458627083": { + "messages": 1, + "level": 0 + }, + "426869596121858077": { + "messages": 1, + "level": 0 + }, + "934366726282416168": { + "messages": 6, + "level": 0 + }, + "444210633035087873": { + "messages": 4, + "level": 0 + }, + "335150031545827339": { + "messages": 50, + "level": 1 + }, + "826165504954728489": { + "messages": 6, + "level": 0 + }, + "808781159373996092": { + "messages": 1, + "level": 0 + }, + "948507609906954240": { + "messages": 2, + "level": 0 + }, + "904315302907625482": { + "messages": 1, + "level": 0 + }, + "773310852782489600": { + "messages": 1, + "level": 0 + }, + "1025055813611552768": { + "messages": 1, + "level": 0 + }, + "715969680124149819": { + "messages": 1, + "level": 0 + }, + "1020392390802030632": { + "messages": 1, + "level": 0 + }, + "743423687239401532": { + "messages": 1, + "level": 0 + }, + "406582522697482241": { + "messages": 1, + "level": 0 + }, + "231907580748759040": { + "messages": 2, + "level": 0 + }, + "461177771801182223": { + "messages": 2, + "level": 0 + }, + "1029465066174677132": { + "messages": 9, + "level": 0 + }, + "387345064927428611": { + "messages": 4, + "level": 0 + }, + "188589285396578304": { + "messages": 1, + "level": 0 + }, + "753750915546218518": { + "messages": 1, + "level": 0 + }, + "923048585128464414": { + "messages": 1, + "level": 0 + }, + "938332923042598933": { + "messages": 1, + "level": 0 + }, + "719181129390751755": { + "messages": 1, + "level": 0 + }, + "949767700987641936": { + "messages": 15, + "level": 0 + }, + "972513020972519484": { + "messages": 87, + "level": 2 + }, + "953310806538330163": { + "messages": 88, + "level": 2 + }, + "823910848204374068": { + "messages": 1, + "level": 0 + }, + "106574361611243520": { + "messages": 1, + "level": 0 + }, + "680580331895914595": { + "messages": 1, + "level": 0 + }, + "949972314685050891": { + "messages": 3, + "level": 0 + }, + "703628676310368257": { + "messages": 4, + "level": 0 + }, + "444715401159639042": { + "messages": 1, + "level": 0 + }, + "298660812334301186": { + "messages": 3, + "level": 0 + }, + "422530069412577280": { + "messages": 2, + "level": 0 + }, + "890295152839655486": { + "messages": 1, + "level": 0 + }, + "802387741991108649": { + "messages": 1, + "level": 0 + }, + "855239162222870568": { + "messages": 2, + "level": 0 + }, + "485097406157815809": { + "messages": 1, + "level": 0 + }, + "581033748225720331": { + "messages": 1, + "level": 0 + }, + "164516469558870016": { + "messages": 1, + "level": 0 + }, + "321162322460672003": { + "messages": 1, + "level": 0 + }, + "738260877676904508": { + "messages": 2, + "level": 0 + }, + "162046726386089984": { + "messages": 6, + "level": 0 + }, + "346936525986201600": { + "messages": 1, + "level": 0 + }, + "791983591286112256": { + "messages": 1, + "level": 0 + }, + "670452818196299810": { + "messages": 5, + "level": 0 + }, + "921881740308512808": { + "messages": 1, + "level": 0 + }, + "695984697326698526": { + "messages": 2, + "level": 0 + }, + "728251545228935169": { + "messages": 1, + "level": 0 + }, + "626598429493297153": { + "messages": 2, + "level": 0 + }, + "566028018733154324": { + "messages": 1, + "level": 0 + }, + "546951491835920424": { + "messages": 1, + "level": 0 + }, + "974265410708992010": { + "messages": 3, + "level": 0 + }, + "986681596767797310": { + "messages": 1, + "level": 0 + }, + "1039929146534543471": { + "messages": 1, + "level": 0 + }, + "833730700162367492": { + "messages": 2, + "level": 0 + }, + "954092707213619221": { + "messages": 6, + "level": 0 + }, + "992954220884021259": { + "messages": 3, + "level": 0 + }, + "284482432684785664": { + "messages": 1, + "level": 0 + }, + "727948378067173407": { + "messages": 1, + "level": 0 + }, + "561664369478467587": { + "messages": 7, + "level": 0 + }, + "490183428990304286": { + "messages": 50, + "level": 1 + }, + "787352638811013151": { + "messages": 1, + "level": 0 + }, + "950809748960325652": { + "messages": 2, + "level": 0 + }, + "992122758110662708": { + "messages": 6, + "level": 0 + }, + "799988133893505054": { + "messages": 2, + "level": 0 + }, + "534500956688351242": { + "messages": 4, + "level": 0 + }, + "989466115803590686": { + "messages": 1, + "level": 0 + }, + "906410212515258398": { + "messages": 2, + "level": 0 + }, + "1040386120657145946": { + "messages": 5, + "level": 0 + }, + "957738491444351046": { + "messages": 4, + "level": 0 + }, + "546309278948917258": { + "messages": 2, + "level": 0 + }, + "697953686487564348": { + "messages": 102, + "level": 2 + }, + "664233182941413427": { + "messages": 19, + "level": 1 + }, + "1040435906546503710": { + "messages": 1, + "level": 0 + }, + "588500582139035648": { + "messages": 1, + "level": 0 + }, + "216383952468967425": { + "messages": 1, + "level": 0 + }, + "1040436260629651476": { + "messages": 2, + "level": 0 + }, + "773516841033138176": { + "messages": 1, + "level": 0 + }, + "1040299894365241465": { + "messages": 14, + "level": 0 + }, + "312915980303204352": { + "messages": 2, + "level": 0 + }, + "1035038630764355625": { + "messages": 3, + "level": 0 + }, + "1013762811710681108": { + "messages": 4, + "level": 0 + }, + "1030163323414650880": { + "messages": 1, + "level": 0 + }, + "104048450017951744": { + "messages": 1, + "level": 0 + }, + "340587045250531358": { + "messages": 39, + "level": 1 + }, + "911709434554777660": { + "messages": 2, + "level": 0 + }, + "955489293734920262": { + "messages": 4, + "level": 0 + }, + "942842318422155334": { + "messages": 1, + "level": 0 + }, + "655418444241698821": { + "messages": 5, + "level": 0 + }, + "1027639990521434172": { + "messages": 1, + "level": 0 + }, + "274616625292902400": { + "messages": 3, + "level": 0 + }, + "395622374361268224": { + "messages": 1, + "level": 0 + }, + "906291810324873316": { + "messages": 18, + "level": 1 + }, + "569941508145283082": { + "messages": 2, + "level": 0 + }, + "821068843102765086": { + "messages": 2, + "level": 0 + }, + "785605148554428497": { + "messages": 3, + "level": 0 + }, + "701688417091584078": { + "messages": 2, + "level": 0 + }, + "907652504253263902": { + "messages": 1, + "level": 0 + }, + "997785792401375252": { + "messages": 3, + "level": 0 + }, + "895364206025637998": { + "messages": 1, + "level": 0 + }, + "963848176912195664": { + "messages": 3, + "level": 0 + }, + "828585944206540850": { + "messages": 3, + "level": 0 + } +} \ No newline at end of file diff --git a/src/events/messageCreate.ts b/src/events/messageCreate.ts new file mode 100644 index 0000000..b7f82f7 --- /dev/null +++ b/src/events/messageCreate.ts @@ -0,0 +1,132 @@ +import Discord, { Channel, ChannelType, TextChannel } from 'discord.js'; +import { TClient } from '../client'; + +export default { + name: 'messageCreate', + execute: async (client: TClient, message: Discord.Message)=>{ + if (!client.config.botSwitches.commands && !client.config.eval.whitelist.includes(message.author.id)) return + if (message.author.bot) return; + if (message.channel.type === ChannelType.DM) return; + const msgarr = message.content.toLowerCase().split(' '); + let automodded: any; + + // Command handler + if (message.content.startsWith(client.config.prefix)){ + const args = message.content.slice(client.config.prefix.length).replace(/\n/g, " ").split(" "); + const commandFile = client.commands.find((x: any)=>x.name === args[0].toLowerCase() || x.alias?.includes(args[0].toLowerCase())); + if (commandFile){ + console.log(`[${client.moment().format('DD/MM/YY HH:mm:ss')}] ${message.author.tag} used ${client.config.prefix}${commandFile.name} in #${message.channelId}`); + // do the cmd + try { + commandFile.run(client, message, args); + commandFile.uses ? commandFile.uses++ : commandFile.uses = 1; + return + } catch (error){ + console.log(error) + client.channels.fetch(client.config.mainServer.channels.errors).then((channel: TextChannel)=>{ + channel.send({embeds: [new client.embed().setColor('#420420').setTitle('Error caught!').setDescription(`**Error:** \`${error.message}\`\n\n**Stack:** \`${`${error.stack}`.slice(0, 2500)}\``)]}) + }) + return message.reply('An error occured while executing that command.') + } + } + } + + function onTimeout(){ + delete client.repeatedMessages[message.author.id] + } + + const Whitelist = [ + // Arrary of channel ids for automod to be disabled in + ] + + if (client.bannedWords._content.some((x: any)=>msgarr.includes(x)) && !message.member.roles.cache.has(client.config.mainServer.roles.dcmod) && message.guildId == client.config.mainServer.id && !Whitelist.includes(message.channelId) && client.config.botSwitches.automod){ + automodded = true; + message.delete(); + message.channel.send('That word is banned here.').then((x: any)=>setTimeout(()=>x.delete(), 5000)); + if (client.repeatedMessages[message.author.id]){ + // add this message to the list + client.repeatedMessages[message.author.id].set(message.createdTimestamp, {cont: 0, ch: message.channelId}); + + // reset timeout + clearTimeout(client.repeatedMessages[message.author.id].to); + client.repeatedMessages[message.author.id].to = setTimeout(onTimeout, 30000); + + // this is the time in which 4 messages have to be sent, in milliseconds (ms) + const threshold = 30000; + + // message mustve been sent after (now - threshold), so purge those that were sent earlier + client.repeatedMessages[message.author.id] = client.repeatedMessages[message.author.id].filter((x: any, i: any)=>i >= Date.now() - threshold) + + // a spammed message is one that has been sent atleast 4 times in the last threshold milliseconds + const spammedMessage = client.repeatedMessages[message.author.id]?.find((x:any)=>{ + return client.repeatedMessages[message.author.id].filter((y:any)=>x.cont === y.cont).size >= 4; + }); + + // if a spammed message exists; + if (spammedMessage){ + // mute + const muteResult = await client.punishments.addPunishment('mute', message.member, {reason: 'Automod; banned words', time: '30m'}, client.user.id); + // and clear their list of long messages + delete client.repeatedMessages[message.author.id]; + } + } else { + client.repeatedMessages[message.author.id] = new client.collection(); + client.repeatedMessages[message.author.id].set(message.createdTimestamp, {cont: 0, ch: message.channelId}); + // autodelete after 30 secs + client.repeatedMessages[message.author.id].to = setTimeout(onTimeout, 30000); + } + } + if (message.content.toLowerCase().includes('discord.gg/') && !message.member.roles.cache.has(client.config.mainServer.roles.dcmod)) { + automodded = true; + message.delete(); + } + + if (message.guildId == client.config.mainServer.id && !automodded){ + client.userLevels.incrementUser(message.author.id); // Ranking incrementation + } + // Mop gifs from banned channels without Monster having to mop them. + const bannedChannels = [ + '516344221452599306', // #mp-moderators + '742324777934520350', // #discord-moderators + ] + if (message.content.toLowerCase().includes('tenor.com/view') || message.content.toLowerCase().includes('giphy.com/gifs/') || message.content.toLowerCase().includes('giphy.com/media/') && bannedChannels.includes(message.channelId)) { + message.reply('Gifs are disabled in this channel.').then((msg: any)=>message.delete()) + } + + // Autoresponse:tm: + if (message.mentions.members.has('309373272594579456') && !client.isStaff(message.member) && message.type != 19){ + message.reply('Please don\'t tag Daggerwin, read rule 14 in <#468846117405196289>') + } + if (message.mentions.members.has('215497515934416896') && !client.isStaff(message.member) && message.type != 19){ + message.reply('Please don\'t tag Monster unless it\'s important!') + } + if (message.content.toLowerCase().startsWith(`${client.config.prefix}players`) || message.content.toLowerCase().startsWith(`${client.config.prefix}status`)){ + message.reply('Commands for the MP server have been moved to `*mp players` and `*mp status`.') + } + if (message.content.toLowerCase().includes('whats the password') || message.content.toLowerCase().includes('what\'s the password') || message.content.toLowerCase().includes('password pls')){ + message.reply('Password and other details can be found in <#543494084363288637>') + } + if (message.content.toLowerCase().includes('i cant read') || message.content.toLowerCase().includes('i can\'t read')){ + message.reply('https://tenor.com/view/aristocats-george-pen-cap-meticulous-gif-5330931') + } + if (message.content.toLowerCase().includes('is daggerbot working')){ + message.reply('https://tenor.com/view/i-still-feel-alive-living-existing-active-singing-gif-14630579') + } + if (message.content.toLowerCase().includes('dead chat') || message.content.toLowerCase().includes('chat is dead')){ + message.reply('https://cdn.discordapp.com/attachments/925589318276382720/1011333656167579849/F57G5ZS.png') + } + if (message.content.toLowerCase().includes('nawdic') && (message.content.toLowerCase().includes('break') || message.content.toLowerCase().includes('broke') || message.content.toLowerCase().includes('broken'))){ + const embed = new client.embed().setTitle('*Nawdic done an oopsie*').setImage('https://c.tenor.com/JSj9ie_MD9kAAAAC/kopfsch%C3%BCtteln-an-kopf-fassen-oh-no.gif').setColor(client.config.embedColor) + message.reply({embeds: [embed]}) + } + if (message.content.toLowerCase().startsWith('good morning') || message.content.toLowerCase().startsWith('morning all') || message.content.toLowerCase().startsWith('morning everyone')){ + message.reply(`Good morning ${message.author.username}!`) + } + if (message.content.toLowerCase().startsWith('good afternoon') || message.content.toLowerCase().startsWith('afternoon all') || message.content.toLowerCase().startsWith('good evening') || message.content.toLowerCase().startsWith('evening all')){ + message.reply(`Good afternoon/evening ${message.author.username}!`) + } + if (message.content.toLowerCase().startsWith('night all') || message.content.toLowerCase().startsWith('night everyone')){ + message.reply(`Night ${message.author.username}`) + } + } +} \ No newline at end of file diff --git a/src/index.ts b/src/index.ts index 2e6d111..9bcb25d 100644 --- a/src/index.ts +++ b/src/index.ts @@ -4,8 +4,6 @@ const client = new TClient; client.init(); import fs = require('node:fs'); import ServerDB from './models/MPServer'; -import axios from 'axios'; -import xjs = require('xml-js'); client.on('ready', async()=>{ client.guilds.cache.forEach(async(e: { members: { fetch: () => any; }; })=>{await e.members.fetch()}); @@ -33,15 +31,15 @@ client.on('ready', async()=>{ }) // Handle errors -process.on('unhandledRejection', async(error)=>{ +process.on('unhandledRejection', async(error: Error)=>{ console.log(error) client.channels.resolve(client.config.mainServer.channels.errors).send({embeds: [new client.embed().setColor('#420420').setTitle('Error caught!').setDescription(`**Error:** \`${error.message}\`\n\n**Stack:** \`${`${error.stack}`.slice(0, 2500)}\``)]}) }); -process.on('uncaughtException', async(error)=>{ +process.on('uncaughtException', async(error: Error)=>{ console.log(error) client.channels.resolve(client.config.mainServer.channels.errors).send({embeds: [new client.embed().setColor('#420420').setTitle('Error caught!').setDescription(`**Error:** \`${error.message}\`\n\n**Stack:** \`${`${error.stack}`.slice(0, 2500)}\``)]}) }); -process.on('error', async(error)=>{ +process.on('error', async(error: Error)=>{ console.log(error) client.channels.resolve(client.config.mainServer.channels.errors).send({embeds: [new client.embed().setColor('#420420').setTitle('Error caught!').setDescription(`**Error:** \`${error.message}\`\n\n**Stack:** \`${`${error.stack}`.slice(0, 2500)}\``)]}) }); @@ -61,7 +59,7 @@ setInterval(async()=>{ const embed = new client.embed(); let Players = []; let Server: any; - let CSG: any; + let CSG: void; let xmlData = undefined; // Connect to DB to retrieve the Gameserver info to fetch data. @@ -74,22 +72,22 @@ setInterval(async()=>{ const completedURL_CSG = DBURL + '/feed/dedicated-server-savegame.html?code=' + DBCode + '&file=careerSavegame' try { - Server = await axios.get(completedURL_DSS, {timeout: 4000}) + Server = await client.axios.get(completedURL_DSS, {timeout: 4000}) } catch (err){ - console.log(`[${client.moment().format('HH:mm:ss')}] dag mp dss fail`) + console.log(`[${client.moment().format('DD/MM/YY HH:mm:ss')}] dag mp dss fail`) embed.setTitle('Data could not be retrieved, the host may not be responding.').setColor(client.config.embedColorRed) msg.edit({embeds: [embed]}) return; } try { - CSG = await axios.get(completedURL_CSG, {timeout: 4100}).then((xml)=>{ - xmlData = xjs.xml2js(xml.data, {compact: true, spaces: 2}).careerSavegame; + CSG = await client.axios.get(completedURL_CSG, {timeout: 4100}).then((xml: any)=>{ + xmlData = client.xjs.xml2js(xml.data, {compact: true, spaces: 2}).careerSavegame; }) } catch (err){ - console.log(`[${client.moment().format('HH:mm:ss')}] dag mp csg fail`) + console.log(`[${client.moment().format('DD/MM/YY HH:mm:ss')}] dag mp csg fail`) } if (xmlData == undefined){ - console.log(`[${client.moment().format('HH:mm:ss')}] dag mp csg failed to convert`) + console.log(`[${client.moment().format('DD/MM/YY HH:mm:ss')}] dag mp csg failed to convert`) embed.setFooter({text: 'XML Data retrieve failed. Retrying in next minute.'}) msg.edit({embeds: [embed]}) } @@ -133,23 +131,42 @@ setInterval(async()=>{ // Event loop for punishments and daily msgs setInterval(async()=>{ + interface Punishment { + id: number; + type: string; + member: string; + moderator: string; + expired?: boolean; + time?: number; + reason: string; + endTime?: number; + cancels?: number; + duration?: number; + } const now = Date.now() const lrsStart = client.config.LRSstart; - client.punishments._content.filter(x=>x.endTime<=now && !x.expired).forEach(async punishment=>{ - console.log(`${punishment.member}'s ${punishment.type} should expire now`); - const unpunishResult = await client.punishments.removePunishment(punishment.id, client.user.id, 'Time\'s up!') - console.log(unpunishResult); + + client.punishments._content.filter((x: Punishment)=>x.endTime<= now && !x.expired).forEach(async (punishment: Punishment)=>{ + console.log(`\x1b[36m[${client.moment().format('DD/MM/YY HH:mm:ss')}]`, '\x1b[32m' + `${punishment.member}\'s ${punishment.type} should expire now`); + const unpunishResult = await client.punishments.removePunishment(punishment.id, client.user.id, 'Time\'s up!'); + console.log(`\x1b[36m[${client.moment().format('DD/MM/YY HH:mm:ss')}]`, '\x1b[32m' + unpunishResult); }); + const formattedDate = Math.floor((now - lrsStart)/1000/60/60/24); const dailyMsgs = require('./database/dailyMsgs.json'); + interface UserLevels { + messages: number, + level: number + } if (!dailyMsgs.some(x=>x[0] === formattedDate)){ - let total = Object.values(client.userLevels._content).reduce((a,b)=>a + b.messages, 0); // sum of all users - const yesterday = dailyMsgs.find(x=>x[0] === formattedDate - 1); + let total = Object.values(client.userLevels._content).reduce((a,b)=>a + b.messages, 0); // sum of all users + const yesterday = dailyMsgs.find((x: Array)=>x[0] === formattedDate - 1); if (total < yesterday){ // messages went down. total = yesterday } dailyMsgs.push([formattedDate, total]); fs.writeFileSync(__dirname + './database/dailyMsgs.json', JSON.stringify(dailyMsgs)) + console.log(`\x1b[36m[${client.moment().format('DD/MM/YY HH:mm:ss')}] \x1b[33m`, `Pushed [${formattedDate}, ${total}] to dailyMsgs`) } }, 5000) @@ -169,4 +186,214 @@ while (client.commands.some(command=>!command.hidden && !command.page)){ command.page = categories[command.category].currentPage; } client.categoryNames = Object.keys(categories); -delete categories; \ No newline at end of file +delete categories; + +// create pages without contents +client.commands.filter(command=>!command.hidden).forEach(command=>{ + if (!client.commandPages.some((x:any)=>x.category === command.category && x.pages === command.pages)){ + client.commandPages.push({ + name: `${command.category} - Page ${command.page}/${Math.max(...client.commands.filter((x:any)=>x.category === command.category).map((x:any)=>x.page))}`, + category: command.category, + page: command.page + }); + } +}); +client.commandPages.sort((a: any, b: any)=>{ + if (a.nameb.name){ + return 1; + } else { + return 0; + } +}); +// Punishments +interface punOpt { + time: number, + reason: string, + message: any +} +interface punData { + id: number; + type: string; + member: string; + moderator: string; + expired?: boolean; + time?: number; + reason?: string; + endTime?: number; + cancels?: number; + duration?: number; +} +Object.assign(client.punishments,{ + createId(){ + return Math.max(...client.punishments._content.map((x: punData)=>x.id), 0) + 1; + }, + async addPunishment(type: string, member: Discord.GuildMember, options: punOpt, moderator: string){ + const now = Date.now(); + const { time, reason, message } = options; + const ms = import('ms'); + let timeInMillis; + if (type !== 'mute'){ + timeInMillis = time ? ms(time) : null; + } else { + timeInMillis = time ? ms(time) : 2419200000; + } + switch (type) { + case 'ban': + const banData: punData = {type, id: this.createId(), member: member.id, moderator, time: now}; + let dm1; + try { + dm1 = await member.send(`You've been banned from ${message.guild.name} ${timeInMillis ? `for ${client.formatTime(timeInMillis, 4, {longNames: true, commas: true})} (${timeInMillis}ms)` : 'forever'} for reason \`${reason || 'Unspecified'}\` (Case #${banData.id})`) + } catch (err) { + setTimeout(()=>message.channel.send('Failed to DM user.'), 500) + } + const banResult = await message.guild.bans.create(member.id, {reason: `${reason || 'Unspecified'} | Case #${banData.id}`}).catch((err: Error)=>err.message); + if (typeof banResult === 'string'){ + dm1.delete(); + return `Ban was unsuccessful: ${banResult}`; + } else { + if (timeInMillis){ + banData.endTime = now + timeInMillis; + banData.duration = timeInMillis; + } + if (reason) banData.reason = reason; + client.makeModlogEntry(banData, client); + this.addData(banData); + this.forceSave(); + return new client.embed().setColor(client.config.embedColor).setTitle(`Case #${banData.id}: Ban`).setDescription(`${member.tag}\n<@${member.id}>\n(\`${member.id}\`)`).addFields( + {name: 'Reason', value: `\`${reason || 'Unspecified'}\``}, + {name: 'Duration', value: `${timeInMillis ? `for ${client.formatTime(timeInMillis, 4, {longNames: true, commas: true})} (${timeInMillis}ms)` : 'forever'}`} + ) + } + case 'softban': + const guild = member.guild; + const softbanData: punData = {type, id: this.createId(), member: member.user.id, moderator, time: now}; + const dm2 = await member.send(`You've been softbanned from ${member.guild.name} for reason \`${reason || 'Unspecified'}\` (Case #${softbanData.id})`).catch(err=>setTimeout(()=>message.channel.send(`Failed to DM <@${member.user.id}>.`), 500)); + const softbanResult = await member.ban({deleteMessageDays: 7, reason: `${reason || 'Unspecified'} | Case #${softbanData.id}`}).catch((err: Error)=>err.message); + if (typeof softbanResult === 'string'){ + dm2.delete(); + return `Softban was unsuccessful: ${softbanResult}`; + } else { + const unbanResult = guild.members.unban(softbanData.member, `${reason || 'Unspecified'} | Case #${softbanData.id}`).catch((err: Error)=>err.message); + if (typeof unbanResult === 'string'){ + return `Softban (unban) was unsuccessful: ${softbanResult}` + } else { + if (reason) softbanData.reason = reason; + client.makeModlogEntry(softbanData, client); + this.addData(softbanData) + this.forceSave(); + return new client.embed().setColor(client.config.embedColor).setTitle(`Case #${softbanData.id}: Softban`).setDescription(`${member.user.tag}\n<@${member.user.id}>\n(\`${member.user.id}\`)`).addFields( + {name: 'Reason', value: `\`${reason || 'Unspecified'}\``} + ) + } + } + case 'kick': + const kickData: punData = {type, id: this.createId(), member: member.user.id, moderator, time: now}; + const dm3 = await member.send(`You've been kicked from ${member.guild.name} for reason \`${reason || 'Unspecified'}\` (Case #${kickData.id})`).catch((err:Error)=>setTimeout(()=>message.channel.send(`Failed to DM <@${member.user.id}>.`), 500)); + const kickResult = await member.kick(`${reason || 'Unspecified'} | Case #${kickData.id}`).catch((err:Error)=>err.message); + if (typeof kickResult === 'string'){ + dm3.delete(); + return `Kick was unsuccessful: ${kickResult}`; + } else { + if (reason) kickData.reason = reason; + client.makeModlogEntry(kickData, client); + this.addData(kickData); + this.forceSave(); + return new client.embed().setColor(client.config.embedColor).setTitle(`Case #${kickData.id}: Kick`).setDescription(`${member.user.tag}\n<@${member.user.id}>\n(\`${member.user.id}\`)`).addFields( + {name: 'Reason', value: `\`${reason || 'Unspecified'}\``} + ) + } + case 'mute': + const muteData: punData = {type, id: this.createId(), member: member.user.id, moderator, time: now}; + let muteResult; + const dm4 = await member.send(`You've been muted in ${member.guild.name} ${timeInMillis ? `for ${client.formatTime(timeInMillis, 4, {longNames: true, commas: true})} (${timeInMillis}ms)` : 'forever'} for reason \`${reason || 'Unspecified'}\` (Case #${muteData.id})`).catch((err:Error)=>setTimeout(()=>message.channel.send('Failed to DM user.'), 500)); + if (timeInMillis){ + muteResult = await member.timeout(timeInMillis, `${reason || 'Unspecified'} | Case #${muteData.id}`).catch((err: Error)=>err.message); + } else { + muteResult = await member.timeout(2419200000, `${reason || 'Unspecified'} | Case #${muteData.id}`).catch((err: Error)=>err.message); + } + if (typeof muteResult === 'string') { + dm4.delete(); + return `Mute was unsuccessful: ${muteResult}`; + } else { + if (timeInMillis){ + muteData.endTime = now + timeInMillis; + muteData.duration = timeInMillis + } + if (reason) muteData.reason = reason; + client.makeModlogEntry(muteData, client); + this.addData(muteData); + this.forceSave(); + const embedm = new client.embed().setColor().setTitle(`Case #${muteData.id}: Mute`).setDescription(`${member.user.tag}\n<@${member.user.id}>\n(\`${member.user.id}\`)`).addFields( + {name: 'Reason', value: `\`${reason || 'Unspecified'}\``}, + {name: 'Duration', value: `${client.formatTime(timeInMillis, 4, {longNames: true, commas: true})} (${timeInMillis}ms)`} + ) + if (moderator !== '795443537356521502') {return embedm}; + } + case 'warn': + const warnData: punData = {type, id: this.createId(), member: member.user.id, moderator, time: now}; + const warnResult = await member.send(`You've been warned in ${member.guild.name} for reason \`${reason || 'Unspecified'}\` (Case #${warnData.id})`).catch((err:Error)=>setTimeout(()=>message.channel.send(`Failed to DM <@${member.user.id}>.`), 500)); + if (typeof warnResult === 'string'){ + return `Warn was unsuccessful: ${warnResult}`; + } else { + if (reason) warnData.reason = reason; + client.makeModlogEntry(warnData, client); + this.addData(warnData); + this.forceSave(); + const embedw = new client.embed().setColor(client.config.embedColor).setTitle(`Case #${warnData.id}: Warn`).setDescription(`${member.user.tag}\n<@${member.user.id}>\n(\`${member.user.id}\`)`).addFields( + {name: 'Reason', value: `\`${reason || 'Unspecified'}\``} + ) + if (moderator !== '795443537356521502') {return embedw}; + } + } + }, + async removePunishment(caseId: number, moderator: any, reason: string){ + const now = Date.now(); + const punishment = this._content.find((x:any)=>x.id === caseId); + const id = this.createId(); + if (!punishment) return 'Punishment not found.'; + if (['ban', 'mute'].includes(punishment.type)){ + const guild = client.guilds.cache.get(client.config.mainServer.id) as Discord.Guild; + let removePunishmentResult; + if(punishment.type === 'ban'){ + // unban + removePunishmentResult = await guild.members.unban(punishment.member, `${reason || 'Unspecified'} | Case #${id}`).catch((err: TypeError)=>err.message); + }else if (punishment.type === 'mute') { + //remove role + const member = await guild.members.fetch(punishment.member).catch(err=>undefined); + if (member){ + removePunishmentResult = await member + if (typeof removePunishmentResult !== 'string'){ + member.timeout(null, `${reason || 'Unspecified'} | Case #${id}`) + removePunishmentResult.send(`You've been unmuted in ${removePunishmentResult.guild.name}.`) + removePunishmentResult = removePunishmentResult.user; //removing a role returns a guildmember + } + }else{ + // user probably left, lets quietly nuke the punishment. + const removePunishmentData = {type: `un${punishment.type}`, id, cancels: punishment.id, member: punishment.member, reason, moderator, time: now}; + this._content[this._content.findIndex(x=>x.id === punishment.id)].expired = true; + this.addData(removePunishmentData).forceSave(); + } + } + if (typeof removePunishmentResult === 'string') return `Un${punishment.type} was unsuccessful: ${removePunishmentResult}`; + else{ + const removePunishmentData = {type: `un${punishment.type}`, id, cancels: punishment.id, member: punishment.member, reason, moderator, time: now}; + client.makeModlogEntry(removePunishmentData, client); + this._content[this._content.findIndex(x=>x.id === punishment.id)].expired = true; + this.addData(removePunishmentData).forceSave(); + return `Successfully ${punishment.type === 'ban' ? 'unbanned' : 'unmuted'} ${removePunishmentResult?.tag} (\`${removePunishmentResult?.id}\`) for reason \`${reason || 'Unspecified'}\``; + } + } else { + try { + const removePunishmentData = {type: 'removeOtherPunishment', id, cancels: punishment.id, member: punishment.member, reason, moderator, time: now}; + client.makeModlogEntry(removePunishmentData, client); + this._content[this._content.findIndex(x=>x.id === punishment.id)].expired = true; + this.addData(removePunishmentData).forceSave(); + return `Successfully removed Case #${punishment.id} (type: ${punishment.type}, user: ${punishment.member}).`; + } catch(error: Error){ + return `${punishment.type[0].toUpperCase()+punishment.type.slice(1)} removal was unsuccessful: ${error.message}` + } + } + } +}) \ No newline at end of file