diff options
38 files changed, 836 insertions, 589 deletions
diff --git a/package.json b/package.json index fa9376c..26a87fe 100644 --- a/package.json +++ b/package.json @@ -55,6 +55,7 @@ "chalk": "^4.1.1", "common-tags": "^1.8.0", "discord-akairo": "NotEnoughUpdates/discord-akairo", + "discord-akairo-message-util": "NotEnoughUpdates/discord-akairo-message-util", "discord-api-types": "0.21.0", "discord.js": "NotEnoughUpdates/discord.js", "discord.js-minesweeper": "^1.0.6", @@ -129,5 +130,13 @@ "singleQuote": true, "trailingComma": "none" }, - "packageManager": "yarn@3.0.0" + "packageManager": "yarn@3.0.0", + "dependenciesMeta": { + "discord-akairo@8.2.2": { + "unplugged": true + }, + "discord-akairo-message-util@1.0.0": { + "unplugged": true + } + } } diff --git a/src/commands/dev/__template.ts b/src/commands/dev/__template.ts index 949e04e..be4f7a7 100644 --- a/src/commands/dev/__template.ts +++ b/src/commands/dev/__template.ts @@ -14,7 +14,6 @@ export default class TemplateCommand extends BushCommand { { id: 'required_argument', type: 'string', - prompt: { start: 'What would you like to set your first argument to be?', retry: '{error} Pick a valid argument.', @@ -24,7 +23,6 @@ export default class TemplateCommand extends BushCommand { { id: 'optional_argument', type: 'string', - prompt: { start: 'What would you like to set your second argument to be?', retry: '{error} Pick a valid argument.', diff --git a/src/commands/dev/_testDB.ts b/src/commands/dev/_testDB.ts deleted file mode 100644 index e1fddb4..0000000 --- a/src/commands/dev/_testDB.ts +++ /dev/null @@ -1,25 +0,0 @@ -// import { BushCommand, BushSlashMessage, Global } from '@lib'; -// import { Message } from 'discord.js'; -// import { inspect } from 'util'; - -// export default class TestDurationCommand extends BushCommand { -// public constructor() { -// super('db', { -// aliases: ['db'], -// category: 'dev', -// description: { -// content: '', -// usage: '', -// examples: [''] -// }, -// slash: false, -// hidden: true, -// ownerOnly: true, -// completelyHide: true -// }); -// } - -// override async exec(message: Message | BushSlashMessage): Promise<unknown> { -// return await message.util.reply(await util.codeblock(inspect((await Global.findOne()).environment), 2000, 'js')); -// } -// } diff --git a/src/commands/dev/_testDuration.ts b/src/commands/dev/_testDuration.ts deleted file mode 100644 index 0591518..0000000 --- a/src/commands/dev/_testDuration.ts +++ /dev/null @@ -1,53 +0,0 @@ -// import { BushCommand, BushSlashMessage } from '@lib'; -// import { stripIndents } from 'common-tags'; -// import { Message } from 'discord.js'; - -// export default class TestDurationCommand extends BushCommand { -// public constructor() { -// super('testduration', { -// aliases: ['testduration'], -// category: 'dev', -// description: { -// content: 'Tests duration parsing.', -// usage: 'testduration [reason]', -// examples: ['testduration'] -// }, -// args: [ -// { -// id: 'reason', -// type: 'contentWithDuration', -// match: 'rest', -// prompt: { -// start: 'Enter text and a duration here.', -// retry: '{error} Error parsing duration and text.', -// optional: true -// } -// } -// ], -// slash: true, -// slashOptions: [ -// { -// name: 'reason', -// description: 'Enter text and a duration here.', -// type: 'STRING', -// required: false -// } -// ], -// hidden: true, -// ownerOnly: true -// }); -// } - -// async exec( -// message: Message | BushSlashMessage, -// { reason }: { reason?: { duration: number; contentWithoutTime: string } } -// ): Promise<unknown> { -// const rawDuration = reason.duration; -// const text = reason.contentWithoutTime; -// const humanizedDuration = util.humanizeDuration(rawDuration); -// return await message.util.reply(stripIndents` -// **rawDuration:** ${rawDuration} -// **text:** ${text} -// **humanizedDuration:** ${humanizedDuration}`); -// } -// } diff --git a/src/commands/moderation/_lockdown.ts b/src/commands/moderation/_lockdown.ts index 374e8f1..32dbd5b 100644 --- a/src/commands/moderation/_lockdown.ts +++ b/src/commands/moderation/_lockdown.ts @@ -31,6 +31,7 @@ export default class LockdownCommand extends BushCommand { userPermissions: ['SEND_MESSAGES'] }); } + public override async exec(message: BushMessage | BushSlashMessage, { all }: { all: boolean }): Promise<unknown> { return await message.util.reply('no'); if (!all) { diff --git a/src/commands/moderation/ban.ts b/src/commands/moderation/ban.ts index cfa3e31..bda0e2b 100644 --- a/src/commands/moderation/ban.ts +++ b/src/commands/moderation/ban.ts @@ -80,7 +80,8 @@ export default class BanCommand extends BushCommand { userPermissions: ['BAN_MEMBERS'] }); } - override async exec( + + public override async exec( message: BushMessage | BushSlashMessage, { user, diff --git a/src/commands/moderation/evidence.ts b/src/commands/moderation/evidence.ts new file mode 100644 index 0000000..96c3944 --- /dev/null +++ b/src/commands/moderation/evidence.ts @@ -0,0 +1,60 @@ +import { BushCommand, BushMessage, BushSlashMessage } from '@lib'; + +export default class EvidenceCommand extends BushCommand { + public constructor() { + super('evidence', { + aliases: ['evidence'], + category: 'moderation', + description: { + content: 'Add evidence to a modlog case.', + usage: 'evidence <caseID> <evidence>', + examples: ['evidence '] + }, + args: [ + { + id: 'required_argument', + type: 'string', + prompt: { + start: 'What would you like to set your first argument to be?', + retry: '{error} Pick a valid argument.', + optional: false + } + }, + { + id: 'optional_argument', + type: 'string', + prompt: { + start: 'What would you like to set your second argument to be?', + retry: '{error} Pick a valid argument.', + optional: true + } + } + ], + slash: true, + slashOptions: [ + { + name: 'required_argument', + description: 'What would you like to set your first argument to be?', + type: 'STRING', + required: true + }, + { + name: 'optional_argument', + description: 'What would you like to set your second argument to be?', + type: 'STRING', + required: false + } + ], + superUserOnly: true, + ownerOnly: true, + channel: 'guild', + hidden: true, + clientPermissions: ['SEND_MESSAGES'], + userPermissions: ['SEND_MESSAGES'] + }); + } + + public override async exec(message: BushMessage | BushSlashMessage): Promise<unknown> { + return await message.util.reply(`${util.emojis.error} Do not use the template command.`); + } +} diff --git a/src/commands/moderation/kick.ts b/src/commands/moderation/kick.ts index c425124..2fc133e 100644 --- a/src/commands/moderation/kick.ts +++ b/src/commands/moderation/kick.ts @@ -55,7 +55,7 @@ export default class KickCommand extends BushCommand { }); } - override async exec( + public override async exec( message: BushMessage | BushSlashMessage, { user, reason, force }: { user: BushUser; reason?: string; force: boolean } ): Promise<unknown> { diff --git a/src/commands/moderation/modlog.ts b/src/commands/moderation/modlog.ts index 8f727a5..84bb5b5 100644 --- a/src/commands/moderation/modlog.ts +++ b/src/commands/moderation/modlog.ts @@ -34,7 +34,7 @@ export default class ModlogCommand extends BushCommand { }); } - private generateModlogInfo(log: ModLog) { + #generateModlogInfo(log: ModLog): string { const modLog = [ `**Case ID**: ${log.id}`, `**Type**: ${log.type.toLowerCase()}`, @@ -43,10 +43,14 @@ export default class ModlogCommand extends BushCommand { ]; if (log.duration) modLog.push(`**Duration**: ${util.humanizeDuration(log.duration)}`); modLog.push(`**Reason**: ${log.reason || 'No Reason Specified.'}`); + if (log.evidence) modLog.push(`**Evidence:** ${log.evidence}`); return modLog.join(`\n`); } - override async exec(message: BushMessage | BushSlashMessage, { search }: { search: BushUser | string }): Promise<unknown> { + public override async exec( + message: BushMessage | BushSlashMessage, + { search }: { search: BushUser | string } + ): Promise<unknown> { const foundUser = search instanceof User ? search : await util.resolveUserAsync(search); if (foundUser) { const logs = await ModLog.findAll({ @@ -59,7 +63,7 @@ export default class ModlogCommand extends BushCommand { if (!logs.length) return message.util.reply(`${util.emojis.error} **${foundUser.tag}** does not have any modlogs.`); const niceLogs: string[] = []; for (const log of logs) { - niceLogs.push(this.generateModlogInfo(log)); + niceLogs.push(this.#generateModlogInfo(log)); } const chunked: string[][] = util.chunk(niceLogs, 3); const embedPages = chunked.map( @@ -76,7 +80,7 @@ export default class ModlogCommand extends BushCommand { if (!entry) return message.util.send(`${util.emojis.error} That modlog does not exist.`); const embed = new MessageEmbed({ title: `Case ${entry.id}`, - description: this.generateModlogInfo(entry), + description: this.#generateModlogInfo(entry), color: util.colors.default }); return await util.buttonPaginate(message, [embed]); diff --git a/src/commands/moderation/mute.ts b/src/commands/moderation/mute.ts index df8e235..9f66558 100644 --- a/src/commands/moderation/mute.ts +++ b/src/commands/moderation/mute.ts @@ -56,6 +56,7 @@ export default class MuteCommand extends BushCommand { userPermissions: ['MANAGE_MESSAGES'] }); } + public override async exec( message: BushMessage | BushSlashMessage, { user, reason, force }: { user: BushUser; reason?: { duration: number; contentWithoutTime: string }; force: boolean } diff --git a/src/commands/moderation/purge.ts b/src/commands/moderation/purge.ts new file mode 100644 index 0000000..f4a53a8 --- /dev/null +++ b/src/commands/moderation/purge.ts @@ -0,0 +1,70 @@ +import { BushCommand, BushMessage } from '../../lib'; + +export default class PurgeCommand extends BushCommand { + public constructor() { + super('purge', { + aliases: ['purge'], + category: 'moderation', + description: { + content: 'A command to mass delete messages.', + usage: 'purge <amount>', + examples: ['Purge 20'] + }, + args: [ + { + id: 'amount', + customType: util.arg.range('integer', 1, 100, true), + prompt: { + start: 'How many messages would you like to purge?', + retry: '{error} Please pick a number between 1 and 100.' + } + }, + { + id: 'bot', + match: 'flag', + flag: '--bot' + }, + { id: 'user', match: 'option', flag: '--user' } + ], + slash: true, + slashOptions: [ + { name: 'amount', description: 'How many messages would you like to purge?', type: 'INTEGER', required: true }, + { + name: 'bot', + description: 'Would you like to only delete messages that are from bots?', + type: 'BOOLEAN', + required: false + } + ], + clientPermissions: ['MANAGE_MESSAGES', 'SEND_MESSAGES', 'EMBED_LINKS'], + userPermissions: ['MANAGE_MESSAGES'], + channel: 'guild' + }); + } + + public override async exec(message: BushMessage, args: { amount: number; bot: boolean }): Promise<unknown> { + if (message.channel.type === 'DM') return message.util.reply(`${util.emojis.error} You cannot run this command in dms.`); + if (args.amount > 100 || args.amount < 1) return message.util.reply(`${util.emojis.error} `); + + const messages = (await message.channel.messages.fetch({ limit: args.amount })).filter((message) => filter(message)); + const filter = (filterMessage: BushMessage): boolean => { + const shouldFilter = new Array<boolean>(); + if (args.bot) { + shouldFilter.push(filterMessage.author.bot); + } + }; + + const purged = await message.channel.bulkDelete(messages, true).catch(() => {}); + if (!purged) return message.util.reply(`${util.emojis.error} Failed to purge messages.`).catch(() => {}); + else { + await message.util + .send(`${util.emojis.success} Successfully purged **${purged.size}** messages.`) + .then(async (purgeMessage: BushMessage) => { + if (!message.util.isSlash) { + await util.sleep(5); + await purgeMessage.delete().catch(() => {}); + } + }); + } + } +} diff --git a/src/commands/moderation/unban.ts b/src/commands/moderation/unban.ts index 522c715..545d75c 100644 --- a/src/commands/moderation/unban.ts +++ b/src/commands/moderation/unban.ts @@ -51,7 +51,7 @@ export default class UnbanCommand extends BushCommand { userPermissions: ['BAN_MEMBERS'] }); } - override async exec( + public override async exec( message: BushMessage | BushSlashMessage, { user, reason }: { user: BushUser; reason?: string } ): Promise<unknown> { diff --git a/src/commands/moderation/unmute.ts b/src/commands/moderation/unmute.ts index 6cdb08b..918c27f 100644 --- a/src/commands/moderation/unmute.ts +++ b/src/commands/moderation/unmute.ts @@ -50,7 +50,8 @@ export default class UnmuteCommand extends BushCommand { userPermissions: ['MANAGE_MESSAGES'] }); } - override async exec( + + public override async exec( message: BushMessage | BushSlashMessage, { user, reason }: { user: BushUser; reason?: string } ): Promise<unknown> { diff --git a/src/commands/moderation/warn.ts b/src/commands/moderation/warn.ts index 1067033..1aa14c3 100644 --- a/src/commands/moderation/warn.ts +++ b/src/commands/moderation/warn.ts @@ -54,6 +54,7 @@ export default class WarnCommand extends BushCommand { userPermissions: ['MANAGE_MESSAGES'] }); } + public override async exec( message: BushMessage | BushSlashMessage, { user, reason, force }: { user: BushUser; reason: string; force: boolean } diff --git a/src/commands/moulberry-bush/level.ts b/src/commands/moulberry-bush/level.ts index fef4538..c202863 100644 --- a/src/commands/moulberry-bush/level.ts +++ b/src/commands/moulberry-bush/level.ts @@ -136,7 +136,7 @@ export default class LevelCommand extends BushCommand { } } - override async exec(message: BushMessage | BushSlashMessage, { user }: { user?: BushUser }): Promise<void> { + public override async exec(message: BushMessage | BushSlashMessage, { user }: { user?: BushUser }): Promise<void> { // await message.reply( // new MessageAttachment( // await this.getImage(user || message.author), diff --git a/src/commands/utilities/hash.ts b/src/commands/utilities/hash.ts index 633a263..16ace93 100644 --- a/src/commands/utilities/hash.ts +++ b/src/commands/utilities/hash.ts @@ -3,7 +3,7 @@ import got from 'got'; import { BushCommand, BushMessage } from '../../lib'; export default class HashCommand extends BushCommand { - constructor() { + public constructor() { super('hash', { aliases: ['hash'], category: 'utilities', diff --git a/src/commands/utilities/youtube.ts b/src/commands/utilities/youtube.ts new file mode 100644 index 0000000..0198173 --- /dev/null +++ b/src/commands/utilities/youtube.ts @@ -0,0 +1,59 @@ +import { VoiceChannel } from 'discord.js'; +import { BushCommand, BushMessage, BushSlashMessage } from '../../lib'; + +export default class YouTubeCommand extends BushCommand { + constructor() { + super('youtube', { + aliases: ['youtube', 'yt'], + category: 'utilities', + description: { + content: "Allows the user to have access to discord's in-app YouTube experiment.", + usage: 'yt <channel>', + examples: ['yt 785281831788216364'] + }, + args: [ + { + id: 'channel', + type: 'voiceChannel', + prompt: { + start: 'What channel would you like to use?', + retry: '{error} Choose a valid voice channel' + } + } + ], + slash: true, + slashOptions: [ + { + name: 'channel', + description: 'What channel would you like to use?', + type: 'CHANNEL', + required: true + } + ], + clientPermissions: ['SEND_MESSAGES'], + userPermissions: ['SEND_MESSAGES'] + }); + } + + public override async exec(message: BushMessage | BushSlashMessage, args: { channel: VoiceChannel }): Promise<unknown> { + if (!args.channel?.id || args.channel?.type != 'GUILD_VOICE') + return await message.util.reply(`${util.emojis.error} Choose a valid voice channel`); + + // @ts-ignore: jank typings + // prettier-ignore + const invite = await this.client.api.channels(args.channel.id).invites.post({ + data: { + validate: null, + max_age: 604800, + max_uses: 0, + target_type: 2, + target_application_id: '755600276941176913', + temporary: false + } + }) + .catch(() => {}); + if (!invite || !invite.code) + return await message.util.reply(`${this.client.util.emojis.error} An error occurred while generating your invite.`); + else return await message.util.send(`https://discord.gg/${invite.code}`); + } +} diff --git a/src/lib/badlinks.json b/src/lib/badlinks.json index 09c3df2..fa5c29c 100644 --- a/src/lib/badlinks.json +++ b/src/lib/badlinks.json @@ -1,70 +1,25 @@ [ - "streammcomunnity.ru", - "stceamcomminity.com", - "steamcommnuninty.com", - "steamcommnunily.com", - "steamncommuniity.com", - "steamcommuniiy.ru", - "steamcomnumity.ru", - "steamoemmunity.com", - "streancommunuty.ru", - "streamcommuninnity.com", - "streamcomnumity.ru", - "stemcommunnilty.com", - "steamsupportpowered.icu", - "staemcomrnunity.store", - "steam-trades.icu", - "facecup.fun", - "fatown.net", - "ultracup.fun", - "iemcup.com", - "esea-mdl.com", - "uspringcup.com", - "denforapasi.cf", - "streamcommulinty.com", - "csskill.com", - "csgo-gifts.com", - "eplcups.com", - "tf2market.store", - "gamerich.xyz", - "anomalygiveaways.pro", - "casefire.fun", - "fineleague.fun", - "stearmcommunnitty.online", - "stearncomminuty.ru", - "stiemcommunitty.ru", - "strearmcommunity.ru", - "steancomunnity.ru", - "cloud9team.space", - "streancommunuty.ru", - "strearmcomunity.ru", - "stermccommunitty.ru", - "steamcommunytu.ru", - "streamcomunity.com", - "steamncommunity.com", - "steamcommunily.uno", "acercup.com", - "xgamercup.com", - "lootxmarket.com", - "roll4tune.com", - "fivetown.net", - "giveavvay.com", - "stermcommuniity.com", - "skinxinfo.net", - "bit-skins.ru", + "affix-cup.ru", + "affix-sport.ru", + "airdrops.tips", "aladdinhub.fun", "allskinz.xyz", "ano-skinspin.xyz", + "anomalygiveaways.pro", "anomalyknifes.xyz", "anomalyskin.xyz", "anomalyskinz.xyz", "anoskinzz.xyz", "berrygamble.com", + "bit-skins.ru", "bitknife.xyz", "bitskines.ru", - "challengeme.vip", + "casefire.fun", "challengeme.in", + "challengeme.vip", "challengme.ru", + "cloud9team.space", "cmepure.com", "cmskillcup.com", "counterpaid.xyz", @@ -85,21 +40,31 @@ "cscoat.eu", "csgo-analyst.com", "csgo-cash.eu", + "csgo-gifts.com", + "csgo-market.ru.com", + "csgo-market.ru.com", "csgo-steamanalyst.net", "csgo-swapskin.com", "csgo-trade.net", "csgo-up.com", "csgobeats.com", + "csgobelieve.ru", "csgocase.one", "csgocashs.com", + "csgocheck.ru.com", "csgocheck.ru", "csgocompetive.com", + "csgocupp.ru.com", + "csgocybersport.ru.com", "csgodetails.info", "csgodreamer.com", "csgodrs.com", + "csgoeasywin.ru.com", "csgoelite.xyz", "csgoencup.com", "csgoevent.xyz", + "csgogift49.xyz", + "csgoindex.ru.com", "csgoindex.ru", "csgoitemdetails.com", "csgoitemsprices.com", @@ -107,6 +72,7 @@ "csgomarble.xyz", "csgomarketplace.net", "csgomarkets.net", + "csgoorun.ru", "csgoprocupgo.com", "csgorcup.com", "csgorose.com", @@ -127,6 +93,7 @@ "csmoneyskinz.xyz", "csmvcecup.com", "csprices.in", + "csskill.com", "csskillpro.xyz", "csskinz.xyz", "cstournament.ru", @@ -136,30 +103,57 @@ "d2faceit.com", "deamonbets.ru", "demonbets.ru", + "denforapasi.cf", "diablobets.com", + "dicsord.gifts", + "discod.gift", + "discord-gifts.com", + "discord-nitro.gifts", + "discord.blog", + "discord.shop", + "discordgivenitro.com", + "discrod.gift", + "disrcod.com", + "dlscord.info", + "dlscord.online", + "dlscord.press", + "dlscord.store", + "dlscord.world", "doatgiveaway.top", "dopeskins.com", - "dota2fight.ru", "dota2fight.net", + "dota2fight.ru", "dota2giveaway.top", "dota2giveaways.top", "dotafights.vip", "dotagiveaway.win", + "dragon-up.online", "earnskinz.xyz", "emeraldbets.ru", + "eplcups.com", + "esea-mdl.com", "esportgaming.ru", "event-games4roll.com", "exchangeuritems.gq", "extraskinscs.xyz", "ezwin24.ru", + "facecup.fun", "faceiteasyleague.ru", + "fatown.net", + "fineleague.fun", "fireopencase.com", + "fivetown.net", "free-skins.ru", + "g2-give.ru", + "g2-give.ru", "game4roll.com", "gameluck.ru", - "games-roll.ru", - "games-roll.ml", + "gamerich.xyz", "games-roll.ga", + "games-roll.ml", + "games-roll.ru", + "gift4keys.com", + "giveavvay.com", "giveawayskin.com", "global-skins.gq", "globalcsskins.xyz", @@ -169,16 +163,20 @@ "gosteamanalyst.com", "gtakey.ru", "hellgiveaway.trade", + "hellstores.xyz", "hltvcsgo.com", "hltvgames.net", + "iemcup.com", + "keys-loot.com", "knifespin.top", - "knifespin.xyz", "knifespin.top", + "knifespin.xyz", "knifespins.xyz", "knifez-roll.xyz", "knifez-win.xyz", "league-csgo.com", "lehatop-01.ru", + "lootxmarket.com", "loungeztrade.com", "lucky-skins.xyz", "makson-gta.ru", @@ -187,25 +185,25 @@ "mvpcup.ru", "mvptournament.com", "mygames4roll.com", + "naviback.ru", "night-skins.com", + "nitros-gift.com", + "nwgwroqr.ru", "ownerbets.com", "playerskinz.xyz", + "pubggift62.xyz", "rangskins.com", + "rave-new.ru", "roll-skins.ru", "roll4knife.xyz", + "roll4tune.com", "rollknfez.xyz", "rollskin-simple.xyz", - "csgo-market.ru.com", - "sakuralive.ru.com", - "csgocupp.ru.com", - "csgoeasywin.ru.com", - "csgocybersport.ru.com", - "csgocheck.ru.com", - "csgo-market.ru.com", - "csgoindex.ru.com", "rushbskins.xyz", "rushskins.xyz", "s1mple-spin.xyz", + "sakuralive.ru.com", + "scale-navi.pp.ru", "simple-knifez.xyz", "simple-win.xyz", "simplegamepro.ru", @@ -214,8 +212,8 @@ "simplewinz.xyz", "skin-index.com", "skin888trade.com", - "skincs-spin.xyz", "skincs-spin.top", + "skincs-spin.xyz", "skinmarkets.net", "skins-hub.top", "skins-info.net", @@ -228,6 +226,7 @@ "skinsplane.com", "skinsplanes.com", "skinsplanets.com", + "skinxinfo.net", "skinxmarket.site", "skinz-spin.top", "skinz-spin.xyz", @@ -235,71 +234,102 @@ "skinzprize.xyz", "skinzspin-cs.xyz", "skinzspinz.xyz", + "sleanmconmunltiy.ru", "spin-games.com", "spin4skinzcs.top", "spin4skinzcs.xyz", "spinforskin.ml", "sponsored-simple.xyz", + "staemcomnrnunitiy.ru.com", + "staemcomrnunity.store", + "staermcrommunity.me", "staffstatsgo.com", "starrygamble.com", "stat-csgo.ru", "stats-cs.ru", + "stceamcomminity.com", "steam-analyst.ru", + "steam-trades.icu", "steamanalysts.com", + "steamcomcunity.ru", + "steamcomminutiu.ru", + "steamcomminutiy.ru", + "steamcomminytiu.com", + "steamcomminytiu.ru", + "steamcomminytu.ru", + "steamcommnunily.com", + "steamcommnuninty.com", + "steamcommnuntiy.com", + "steamcommrutiny.ru", + "steamcommuniiy.ru", + "steamcommunily.uno", + "steamcommunityu.com", + "steamcommunityw.com", + "steamcommunlty.pro", + "steamcommunutiy.com", + "steamcommunytiu.ru", + "steamcommunytu.ru", + "steamcommutiny.com", + "steamcommynitu.ru", + "steamcomnmuituy.com", + "steamcomnumity.ru", + "steamcomrnunity.ru", + "steamcomrrnunity.com", + "steamcomrunity.com", + "steamconmunlty.com", + "steamcormmuntiy.com", "steamgamesroll.ru", + "steamncommuniity.com", + "steamncommunity.com", + "steamnmcomunnity.co", + "steamoemmunity.com", + "steamsupportpowered.icu", + "steancommynity.ru.com", + "steancomnunytu.ru", + "steancomunnity.ru", + "steancomunyiti.ru", + "stearmcommunnitty.online", + "stearmmcomunitty.ru", + "stearmmcomunity.ru", + "stearmmcomuunity.ru", + "stearncomminuty.ru", + "stearncommunity.ru", + "stearncommunytiy.ru", + "stearncormmunity.com", + "steemcommnunity.ru", + "stemcommunnilty.com", + "stermccommunitty.ru", + "stermcommuniity.com", "stewie2k-giveaway-150days.pro", + "stiemcommunitty.ru", + "store-stempowered.com", + "streamcommulinty.com", + "streamcommuninnity.com", + "streamcommuunnity.com", + "streamcomnumity.ru", + "streamcomunity.com", + "streammcomunnity.ru", + "streancommunuty.ru", + "streancommunuty.ru", + "strearmcommunity.ru", + "strearmcomunity.ru", "sunnygamble.com", "swapskins.live", "test-domuin2.com", "test-domuin3.ru", "test-domuin4.ru", "test-domuin5.ru", + "tf2market.store", "tournamentt.com", - "waterbets.ru", "ultimateskins.xyz", + "ultracup.fun", + "uspringcup.com", + "waterbets.ru", "win-skin.top", "win-skin.xyz", "winknifespin.xyz", "winskin-simple.xyz", "winskins.top", "wintheskin.xyz", - "steemcommnunity.ru", - "steamcomminytu.ru", - "stearncommunity.ru", - "stearncommunytiy.ru", - "steamcommutiny.com", - "steamcomrunity.com", - "steamcommunytiu.ru", - "steamcommnuntiy.com", - "steamcomminytiu.ru", - "steamcomminytiu.com", - "steancomunyiti.ru", - "steamcormmuntiy.com", - "store-stempowered.com", - "dlscord.store", - "streamcommuunnity.com", - "steamcommunityw.com", - "steamconmunlty.com", - "steamcommrutiny.ru", - "dlscord.info", - "steamcomnmuituy.com", - "steamcommunityu.com", - "dicsord.gifts", - "discod.gift", - "discord-nitro.gifts", - "steamcomrrnunity.com", - "stearmmcomunity.ru", - "stearmmcomunitty.ru", - "steamcomminutiu.ru", - "steamcommunlty.pro", - "discord.shop", - "discord.blog", - "steamcomminutiy.ru", - "airdrops.tips", - "steamnmcomunnity.co", - "discrod.gift", - "steancomnunytu.ru", - "discord-gifts.com", - "steamcommunutiy.com", - "dlscord.online" + "xgamercup.com" ] diff --git a/src/lib/extensions/discord-akairo/BushClient.ts b/src/lib/extensions/discord-akairo/BushClient.ts index 4c2b940..8de630f 100644 --- a/src/lib/extensions/discord-akairo/BushClient.ts +++ b/src/lib/extensions/discord-akairo/BushClient.ts @@ -9,6 +9,7 @@ import { MessageEditOptions, MessageOptions, MessagePayload, + PartialDMChannel, ReplyMessageOptions, Snowflake, Structures, @@ -83,6 +84,7 @@ export type BushThreadChannelResolvable = BushThreadChannel | Snowflake; export type BushApplicationCommandResolvable = BushApplicationCommand | Snowflake; export type BushGuildTextChannelResolvable = BushTextChannel | BushNewsChannel | Snowflake; export type BushChannelResolvable = BushChannel | Snowflake; +export type BushTextBasedChannels = PartialDMChannel | BushDMChannel | BushTextChannel | BushNewsChannel | BushThreadChannel; export interface BushFetchedThreads { threads: Collection<Snowflake, BushThreadChannel>; hasMore?: boolean; @@ -96,7 +98,7 @@ const rl = readline.createInterface({ type If<T extends boolean, A, B = null> = T extends true ? A : T extends false ? B : A | B; -export class BushClient<Ready extends boolean = boolean> extends AkairoClient { +export class BushClient<Ready extends boolean = boolean> extends AkairoClient<Ready> { public static preStart(): void { Structures.extend('GuildEmoji', () => BushGuildEmoji); Structures.extend('DMChannel', () => BushDMChannel); @@ -134,7 +136,7 @@ export class BushClient<Ready extends boolean = boolean> extends AkairoClient { public declare util: BushClientUtil; public declare ownerID: Snowflake[]; public db: Sequelize; - public logger: BushLogger; + public logger = BushLogger; public constants = BushConstants; public cache = BushCache; public constructor(config: Config) { @@ -156,7 +158,6 @@ export class BushClient<Ready extends boolean = boolean> extends AkairoClient { this.token = config.token; this.config = config; - // Create listener handler this.listenerHandler = new BushListenerHandler(this, { directory: path.join(__dirname, '..', '..', '..', 'listeners'), @@ -216,10 +217,9 @@ export class BushClient<Ready extends boolean = boolean> extends AkairoClient { port: this.config.db.port, logging: this.config.logging.db ? (sql) => this.logger.debug(sql) : false }); - this.logger = new BushLogger(this); } - get console(): BushLogger { + get console(): typeof BushLogger { return this.logger; } @@ -228,7 +228,7 @@ export class BushClient<Ready extends boolean = boolean> extends AkairoClient { } // Initialize everything - private async _init(): Promise<void> { + async #init(): Promise<void> { this.commandHandler.useListenerHandler(this.listenerHandler); this.commandHandler.useInhibitorHandler(this.inhibitorHandler); this.commandHandler.ignorePermissions = this.config.owners; @@ -296,7 +296,7 @@ export class BushClient<Ready extends boolean = boolean> extends AkairoClient { global.util = this.util; try { - await this._init(); + await this.#init(); await this.login(this.token); } catch (e) { await this.console.error('Start', chalk.red(e?.stack || e), false); diff --git a/src/lib/extensions/discord-akairo/BushClientUtil.ts b/src/lib/extensions/discord-akairo/BushClientUtil.ts index af64624..42d3d13 100644 --- a/src/lib/extensions/discord-akairo/BushClientUtil.ts +++ b/src/lib/extensions/discord-akairo/BushClientUtil.ts @@ -102,7 +102,7 @@ export class BushClientUtil extends ClientUtil { /** The client of this ClientUtil */ public declare readonly client: BushClient; /** The hastebin urls used to post to hastebin, attempts to post in order */ - public hasteURLs: string[] = [ + #hasteURLs: string[] = [ 'https://hst.sh', 'https://hasteb.in', 'https://hastebin.com', @@ -112,7 +112,7 @@ export class BushClientUtil extends ClientUtil { 'https://haste.unbelievaboat.com', 'https://haste.tyman.tech' ]; - public paginateEmojis = { + #paginateEmojis = { beginning: '853667381335162910', back: '853667410203770881', stop: '853667471110570034', @@ -121,7 +121,7 @@ export class BushClientUtil extends ClientUtil { }; /** A simple promise exec method */ - private exec = promisify(exec); + #exec = promisify(exec); /** * Creates this client util @@ -158,7 +158,7 @@ export class BushClientUtil extends ClientUtil { stdout: string; stderr: string; }> { - return await this.exec(command); + return await this.#exec(command); } /** @@ -167,7 +167,7 @@ export class BushClientUtil extends ClientUtil { * @returns The url of the posted text */ public async haste(content: string): Promise<string> { - for (const url of this.hasteURLs) { + for (const url of this.#hasteURLs) { try { const res: hastebinRes = await got.post(`${url}/documents`, { body: content }).json(); return `${url}/${res.key}`; @@ -301,7 +301,7 @@ export class BushClientUtil extends ClientUtil { text: string | null = null, deleteOnExit?: boolean ): Promise<void> { - const paginateEmojis = this.paginateEmojis; + const paginateEmojis = this.#paginateEmojis; if (deleteOnExit === undefined) deleteOnExit = true; if (embeds.length === 1) { @@ -407,7 +407,7 @@ export class BushClientUtil extends ClientUtil { /** Sends a message with a button for the user to delete it. */ public async sendWithDeleteButton(message: BushMessage | BushSlashMessage, options: MessageOptions): Promise<void> { - const paginateEmojis = this.paginateEmojis; + const paginateEmojis = this.#paginateEmojis; updateOptions(); const msg = await message.util.reply(options as MessageOptions & { split?: false }); const filter = (interaction: ButtonInteraction) => interaction.customId == 'paginate__stop' && interaction.message == msg; @@ -465,7 +465,7 @@ export class BushClientUtil extends ClientUtil { return tildes + language + '\n' + code2 + '\n' + tildes + (hasteOut.length ? '\n' + hasteOut : ''); } - private mapCredential(old: string) { + #mapCredential(old: string): string { const mapping = { ['token']: 'Main Token', ['devToken']: 'Dev Token', @@ -481,7 +481,7 @@ export class BushClientUtil extends ClientUtil { public redact(text: string) { for (const credentialName in client.config.credentials) { const credential = client.config.credentials[credentialName]; - const replacement = this.mapCredential(credentialName); + const replacement = this.#mapCredential(credentialName); const escapeRegex = /[.*+?^${}()|[\]\\]/g; text = text.replace(new RegExp(credential.toString().replace(escapeRegex, '\\$&'), 'g'), `[${replacement} Omitted]`); text = text.replace( @@ -702,7 +702,7 @@ export class BushClientUtil extends ClientUtil { const expires = options.duration ? new Date(new Date().getTime() + options.duration) : null; const user = client.users.resolveId(options.user); const guild = client.guilds.resolveId(options.guild); - const type = this.findTypeEnum(options.type); + const type = this.#findTypeEnum(options.type); const entry = options.extraInfo ? ActivePunishment.build({ user, type, guild, expires, modlog: options.modlog, extraInfo: options.extraInfo }) @@ -720,7 +720,7 @@ export class BushClientUtil extends ClientUtil { }): Promise<boolean> { const user = client.users.resolveId(options.user); const guild = client.guilds.resolveId(options.guild); - const type = this.findTypeEnum(options.type); + const type = this.#findTypeEnum(options.type); let success = true; @@ -743,7 +743,7 @@ export class BushClientUtil extends ClientUtil { return success; } - private findTypeEnum(type: 'mute' | 'ban' | 'role' | 'block') { + #findTypeEnum(type: 'mute' | 'ban' | 'role' | 'block') { const typeMap = { ['mute']: ActivePunishmentType.MUTE, ['ban']: ActivePunishmentType.BAN, @@ -915,4 +915,11 @@ export class BushClientUtil extends ClientUtil { return Argument.withInput(type); } })(); + + /** + * Wait an amount in seconds. + */ + public async sleep(s: number): Promise<unknown> { + return new Promise((resolve) => setTimeout(resolve, s * 1000)); + } } diff --git a/src/lib/extensions/discord.js/BushApplicationCommand.ts b/src/lib/extensions/discord.js/BushApplicationCommand.ts index 2acf7f8..171e2ad 100644 --- a/src/lib/extensions/discord.js/BushApplicationCommand.ts +++ b/src/lib/extensions/discord.js/BushApplicationCommand.ts @@ -4,7 +4,7 @@ import { ApplicationCommand, Snowflake } from 'discord.js'; import { BushClient } from '../discord-akairo/BushClient'; import { BushGuild } from './BushGuild'; -export class BushApplicationCommand<PermissionsFetchType = {}> extends ApplicationCommand { +export class BushApplicationCommand<PermissionsFetchType = {}> extends ApplicationCommand<PermissionsFetchType> { public declare readonly client: BushClient; public declare guild: BushGuild | null; diff --git a/src/lib/extensions/discord.js/BushChannel.d.ts b/src/lib/extensions/discord.js/BushChannel.d.ts index 482dd9b..5aa3422 100644 --- a/src/lib/extensions/discord.js/BushChannel.d.ts +++ b/src/lib/extensions/discord.js/BushChannel.d.ts @@ -1,10 +1,7 @@ import { Snowflake } from 'discord-api-types'; import { Channel, ChannelMention } from 'discord.js'; import { ChannelTypes } from 'discord.js/typings/enums'; -import { BushClient } from '../discord-akairo/BushClient'; -import { BushDMChannel } from './BushDMChannel'; -import { BushNewsChannel } from './BushNewsChannel'; -import { BushTextChannel } from './BushTextChannel'; +import { BushClient, BushTextBasedChannels } from '../discord-akairo/BushClient'; import { BushThreadChannel } from './BushThreadChannel'; export class BushChannel extends Channel { @@ -17,7 +14,7 @@ export class BushChannel extends Channel { public type: keyof typeof ChannelTypes; public delete(): Promise<BushChannel>; public fetch(force?: boolean): Promise<BushChannel>; - public isText(): this is BushTextChannel | BushDMChannel | BushNewsChannel | BushThreadChannel; + public isText(): this is BushTextBasedChannels; public isThread(): this is BushThreadChannel; public toString(): ChannelMention; } diff --git a/src/lib/extensions/discord.js/BushGuildMember.ts b/src/lib/extensions/discord.js/BushGuildMember.ts index 142b766..ec0e323 100644 --- a/src/lib/extensions/discord.js/BushGuildMember.ts +++ b/src/lib/extensions/discord.js/BushGuildMember.ts @@ -82,21 +82,16 @@ export class BushGuildMember extends GuildMember { public async warn(options: BushPunishmentOptions): Promise<{ result: WarnResponse; caseNum: number }> { const moderator = client.users.cache.get(client.users.resolveId(options.moderator || client.user)); // add modlog entry - const result = await util - .createModLogEntry( - { - type: ModLogType.WARN, - user: this, - moderator: moderator.id, - reason: options.reason, - guild: this.guild - }, - true - ) - .catch((e) => { - void client.console.error('warn', e, true, 1); - return { log: null, caseNum: null }; - }); + const result = await util.createModLogEntry( + { + type: ModLogType.WARN, + user: this, + moderator: moderator.id, + reason: options.reason, + guild: this.guild + }, + true + ); if (!result || !result.log) return { result: 'error creating modlog entry', caseNum: null }; // dm user @@ -113,33 +108,31 @@ export class BushGuildMember extends GuildMember { } public async addRole(options: AddRoleOptions): Promise<AddRoleResponse> { - const ifShouldAddRole = this.checkIfShouldAddRole(options.role); + const ifShouldAddRole = this.#checkIfShouldAddRole(options.role); if (ifShouldAddRole !== true) return ifShouldAddRole; const moderator = client.users.cache.get(client.users.resolveId(options.moderator || client.user)); if (options.addToModlog) { - const { log: modlog } = await util - .createModLogEntry({ - type: options.duration ? ModLogType.TEMP_PUNISHMENT_ROLE : ModLogType.PERM_PUNISHMENT_ROLE, - guild: this.guild, - moderator: moderator.id, - user: this, - reason: 'N/A' - }) - .catch(() => null); + const { log: modlog } = await util.createModLogEntry({ + type: options.duration ? ModLogType.TEMP_PUNISHMENT_ROLE : ModLogType.PERM_PUNISHMENT_ROLE, + guild: this.guild, + moderator: moderator.id, + user: this, + reason: 'N/A' + }); + if (!modlog) return 'error creating modlog entry'; - const punishmentEntrySuccess = await util - .createPunishmentEntry({ - type: 'role', - user: this, - guild: this.guild, - duration: options.duration, - modlog: modlog.id, - extraInfo: options.role.id - }) - .catch(() => null); + const punishmentEntrySuccess = await util.createPunishmentEntry({ + type: 'role', + user: this, + guild: this.guild, + duration: options.duration, + modlog: modlog.id, + extraInfo: options.role.id + }); + if (!punishmentEntrySuccess) return 'error creating role entry'; } @@ -150,30 +143,28 @@ export class BushGuildMember extends GuildMember { } public async removeRole(options: RemoveRoleOptions): Promise<RemoveRoleResponse> { - const ifShouldAddRole = this.checkIfShouldAddRole(options.role); + const ifShouldAddRole = this.#checkIfShouldAddRole(options.role); if (ifShouldAddRole !== true) return ifShouldAddRole; const moderator = client.users.cache.get(client.users.resolveId(options.moderator || client.user)); if (options.addToModlog) { - const { log: modlog } = await util - .createModLogEntry({ - type: ModLogType.PERM_PUNISHMENT_ROLE, - guild: this.guild, - moderator: moderator.id, - user: this, - reason: 'N/A' - }) - .catch(() => null); + const { log: modlog } = await util.createModLogEntry({ + type: ModLogType.PERM_PUNISHMENT_ROLE, + guild: this.guild, + moderator: moderator.id, + user: this, + reason: 'N/A' + }); + if (!modlog) return 'error creating modlog entry'; - const punishmentEntrySuccess = await util - .removePunishmentEntry({ - type: 'role', - user: this, - guild: this.guild - }) - .catch(() => null); + const punishmentEntrySuccess = await util.removePunishmentEntry({ + type: 'role', + user: this, + guild: this.guild + }); + if (!punishmentEntrySuccess) return 'error removing role entry'; } @@ -183,13 +174,13 @@ export class BushGuildMember extends GuildMember { return 'success'; } - private checkIfShouldAddRole(role: BushRole | Role) { + #checkIfShouldAddRole(role: BushRole | Role): true | 'user hierarchy' | 'role managed' | 'client hierarchy' { if (this.roles.highest.position <= role.position) { - return `user hierarchy`; + return 'user hierarchy'; } else if (role.managed) { - return `role managed`; + return 'role managed'; } else if (this.guild.me.roles.highest.position <= role.position) { - return `client hierarchy`; + return 'client hierarchy'; } return true; } @@ -212,28 +203,26 @@ export class BushGuildMember extends GuildMember { if (!muteSuccess) return 'error giving mute role'; // add modlog entry - const { log: modlog } = await util - .createModLogEntry({ - type: options.duration ? ModLogType.TEMP_MUTE : ModLogType.PERM_MUTE, - user: this, - moderator: moderator.id, - reason: options.reason, - duration: options.duration, - guild: this.guild - }) - .catch(() => null); + const { log: modlog } = await util.createModLogEntry({ + type: options.duration ? ModLogType.TEMP_MUTE : ModLogType.PERM_MUTE, + user: this, + moderator: moderator.id, + reason: options.reason, + duration: options.duration, + guild: this.guild + }); + if (!modlog) return 'error creating modlog entry'; // add punishment entry so they can be unmuted later - const punishmentEntrySuccess = await util - .createPunishmentEntry({ - type: 'mute', - user: this, - guild: this.guild, - duration: options.duration, - modlog: modlog.id - }) - .catch(() => null); + const punishmentEntrySuccess = await util.createPunishmentEntry({ + type: 'mute', + user: this, + guild: this.guild, + duration: options.duration, + modlog: modlog.id + }); + if (!punishmentEntrySuccess) return 'error creating mute entry'; // dm user @@ -242,7 +231,7 @@ export class BushGuildMember extends GuildMember { content: `You have been muted ${ options.duration ? 'for ' + util.humanizeDuration(options.duration) : 'permanently' } in **${this.guild}** for **${options.reason || 'No reason provided'}**.${ending ? `\n\n${ending}` : ''}` - }).catch(() => null); + }); if (!dmSuccess) return 'failed to dm'; @@ -267,25 +256,23 @@ export class BushGuildMember extends GuildMember { if (!muteSuccess) return 'error removing mute role'; //remove modlog entry - const { log: modlog } = await util - .createModLogEntry({ - type: ModLogType.UNMUTE, - user: this, - moderator: moderator.id, - reason: options.reason, - guild: this.guild - }) - .catch(() => null); + const { log: modlog } = await util.createModLogEntry({ + type: ModLogType.UNMUTE, + user: this, + moderator: moderator.id, + reason: options.reason, + guild: this.guild + }); + if (!modlog) return 'error creating modlog entry'; // remove mute entry - const removePunishmentEntrySuccess = await util - .removePunishmentEntry({ - type: 'mute', - user: this, - guild: this.guild - }) - .catch(() => null); + const removePunishmentEntrySuccess = await util.removePunishmentEntry({ + type: 'mute', + user: this, + guild: this.guild + }); + if (!removePunishmentEntrySuccess) return 'error removing mute entry'; //dm user @@ -353,28 +340,24 @@ export class BushGuildMember extends GuildMember { if (!banSuccess) return 'error banning'; // add modlog entry - const { log: modlog } = await util - .createModLogEntry({ - type: options.duration ? ModLogType.TEMP_BAN : ModLogType.PERM_BAN, - user: this, - moderator: moderator.id, - reason: options.reason, - duration: options.duration, - guild: this.guild - }) - .catch(() => null); + const { log: modlog } = await util.createModLogEntry({ + type: options.duration ? ModLogType.TEMP_BAN : ModLogType.PERM_BAN, + user: this, + moderator: moderator.id, + reason: options.reason, + duration: options.duration, + guild: this.guild + }); if (!modlog) return 'error creating modlog entry'; // add punishment entry so they can be unbanned later - const punishmentEntrySuccess = await util - .createPunishmentEntry({ - type: 'ban', - user: this, - guild: this.guild, - duration: options.duration, - modlog: modlog.id - }) - .catch(() => null); + const punishmentEntrySuccess = await util.createPunishmentEntry({ + type: 'ban', + user: this, + guild: this.guild, + duration: options.duration, + modlog: modlog.id + }); if (!punishmentEntrySuccess) return 'error creating ban entry'; if (!dmSuccess) return 'failed to dm'; diff --git a/src/lib/models/ActivePunishment.ts b/src/lib/models/ActivePunishment.ts index a757b10..fb2e79f 100644 --- a/src/lib/models/ActivePunishment.ts +++ b/src/lib/models/ActivePunishment.ts @@ -29,6 +29,8 @@ export interface ActivePunishmentModelCreationAttributes { modlog: string; } +const NEVER_USED = 'This should never be executed'; + export class ActivePunishment extends BaseModel<ActivePunishmentModel, ActivePunishmentModelCreationAttributes> implements ActivePunishmentModel @@ -37,73 +39,73 @@ export class ActivePunishment * The ID of this punishment (no real use just for a primary key) */ public get id(): string { - throw new Error('This should never be executed'); + throw new Error(NEVER_USED); } public set id(_: string) { - throw new Error('This should never be executed'); + throw new Error(NEVER_USED); } /** * The type of punishment. */ public get type(): ActivePunishmentType { - throw new Error('This should never be executed'); + throw new Error(NEVER_USED); } public set type(_: ActivePunishmentType) { - throw new Error('This should never be executed'); + throw new Error(NEVER_USED); } /** * The user who is punished. */ public get user(): Snowflake { - throw new Error('This should never be executed'); + throw new Error(NEVER_USED); } public set user(_: Snowflake) { - throw new Error('This should never be executed'); + throw new Error(NEVER_USED); } /** * The guild they are punished in. */ public get guild(): Snowflake { - throw new Error('This should never be executed'); + throw new Error(NEVER_USED); } public set guild(_: Snowflake) { - throw new Error('This should never be executed'); + throw new Error(NEVER_USED); } /** * Additional info about the punishment if applicable. The channel id for channel blocks and role for punishment roles. */ public get extraInfo(): Snowflake { - throw new Error('This should never be executed'); + throw new Error(NEVER_USED); } public set extraInfo(_: Snowflake) { - throw new Error('This should never be executed'); + throw new Error(NEVER_USED); } /** * The date when this punishment expires (optional). */ public get expires(): Date | null { - throw new Error('This should never be executed'); + throw new Error(NEVER_USED); } public set expires(_: Date | null) { - throw new Error('This should never be executed'); + throw new Error(NEVER_USED); } /** * The reference to the modlog entry. */ public get modlog(): string { - throw new Error('This should never be executed'); + throw new Error(NEVER_USED); } public set modlog(_: string) { - throw new Error('This should never be executed'); + throw new Error(NEVER_USED); } - static initModel(sequelize: Sequelize): void { + public static initModel(sequelize: Sequelize): void { ActivePunishment.init( { id: { diff --git a/src/lib/models/BaseModel.ts b/src/lib/models/BaseModel.ts index f1521dd..8ed5ed3 100644 --- a/src/lib/models/BaseModel.ts +++ b/src/lib/models/BaseModel.ts @@ -1,17 +1,19 @@ import { Model } from 'sequelize'; +const NEVER_USED = 'This should never be executed'; + export abstract class BaseModel<A, B> extends Model<A, B> { /** * The date when the row was created. */ public get createdAt(): Date { - throw new Error('This should never be executed'); + throw new Error(NEVER_USED); } /** * The date when the row was last updated. */ public get updatedAt(): Date { - throw new Error('This should never be executed'); + throw new Error(NEVER_USED); } } diff --git a/src/lib/models/Global.ts b/src/lib/models/Global.ts index a685d91..36c72d8 100644 --- a/src/lib/models/Global.ts +++ b/src/lib/models/Global.ts @@ -20,68 +20,70 @@ export interface GlobalModelCreationAttributes { blacklistedChannels?: Snowflake[]; } +const NEVER_USED = 'This should never be executed'; + export class Global extends BaseModel<GlobalModel, GlobalModelCreationAttributes> implements GlobalModel { /** * The bot's environment. */ public get environment(): 'production' | 'development' | 'beta' { - throw new Error('This should never be executed'); + throw new Error(NEVER_USED); } public set environment(_: 'production' | 'development' | 'beta') { - throw new Error('This should never be executed'); + throw new Error(NEVER_USED); } /** * Trusted users. */ public get superUsers(): Snowflake[] { - throw new Error('This should never be executed'); + throw new Error(NEVER_USED); } public set superUsers(_: Snowflake[]) { - throw new Error('This should never be executed'); + throw new Error(NEVER_USED); } /** * Globally disabled commands. */ public get disabledCommands(): string[] { - throw new Error('This should never be executed'); + throw new Error(NEVER_USED); } public set disabledCommands(_: string[]) { - throw new Error('This should never be executed'); + throw new Error(NEVER_USED); } /** * Globally blacklisted users. */ public get blacklistedUsers(): Snowflake[] { - throw new Error('This should never be executed'); + throw new Error(NEVER_USED); } public set blacklistedUsers(_: Snowflake[]) { - throw new Error('This should never be executed'); + throw new Error(NEVER_USED); } /** * Guilds blacklisted from using the bot. */ public get blacklistedGuilds(): Snowflake[] { - throw new Error('This should never be executed'); + throw new Error(NEVER_USED); } public set blacklistedGuilds(_: Snowflake[]) { - throw new Error('This should never be executed'); + throw new Error(NEVER_USED); } /** * Channels where the bot is prevented from running. */ public get blacklistedChannels(): Snowflake[] { - throw new Error('This should never be executed'); + throw new Error(NEVER_USED); } public set blacklistedChannels(_: Snowflake[]) { - throw new Error('This should never be executed'); + throw new Error(NEVER_USED); } - static initModel(sequelize: Sequelize): void { + public static initModel(sequelize: Sequelize): void { Global.init( { environment: { diff --git a/src/lib/models/Guild.ts b/src/lib/models/Guild.ts index c28fe64..3473ea4 100644 --- a/src/lib/models/Guild.ts +++ b/src/lib/models/Guild.ts @@ -31,118 +31,120 @@ export interface GuildModelCreationAttributes { autoModPhases?: string[]; } +const NEVER_USED = 'This should never be executed'; + export class Guild extends BaseModel<GuildModel, GuildModelCreationAttributes> implements GuildModel { /** * The ID of the guild */ public get id(): Snowflake { - throw new Error('This should never be executed'); + throw new Error(NEVER_USED); } public set id(_: Snowflake) { - throw new Error('This should never be executed'); + throw new Error(NEVER_USED); } /** * The bot's prefix for the guild */ public get prefix(): string { - throw new Error('This should never be executed'); + throw new Error(NEVER_USED); } public set prefix(_: string) { - throw new Error('This should never be executed'); + throw new Error(NEVER_USED); } /** * Channels that will have their messages automatically published */ public get autoPublishChannels(): Snowflake[] { - throw new Error('This should never be executed'); + throw new Error(NEVER_USED); } public set autoPublishChannels(_: Snowflake[]) { - throw new Error('This should never be executed'); + throw new Error(NEVER_USED); } /** * Channels where the bot won't respond in. */ public get blacklistedChannels(): Snowflake[] { - throw new Error('This should never be executed'); + throw new Error(NEVER_USED); } public set blacklistedChannels(_: Snowflake[]) { - throw new Error('This should never be executed'); + throw new Error(NEVER_USED); } /** * Users that the bot ignores in this guild */ public get blacklistedUsers(): Snowflake[] { - throw new Error('This should never be executed'); + throw new Error(NEVER_USED); } public set blacklistedUsers(_: Snowflake[]) { - throw new Error('This should never be executed'); + throw new Error(NEVER_USED); } /** * The channels where the welcome messages are sent */ public get welcomeChannel(): Snowflake { - throw new Error('This should never be executed'); + throw new Error(NEVER_USED); } public set welcomeChannel(_: Snowflake) { - throw new Error('This should never be executed'); + throw new Error(NEVER_USED); } /** * The role given out when muting someone */ public get muteRole(): Snowflake { - throw new Error('This should never be executed'); + throw new Error(NEVER_USED); } public set muteRole(_: Snowflake) { - throw new Error('This should never be executed'); + throw new Error(NEVER_USED); } /** * The message that gets sent after someone gets a punishment dm */ public get punishmentEnding(): string { - throw new Error('This should never be executed'); + throw new Error(NEVER_USED); } public set punishmentEnding(_: string) { - throw new Error('This should never be executed'); + throw new Error(NEVER_USED); } /** * Guild specific disabled commands */ public get disabledCommands(): string[] { - throw new Error('This should never be executed'); + throw new Error(NEVER_USED); } public set disabledCommands(_: string[]) { - throw new Error('This should never be executed'); + throw new Error(NEVER_USED); } /** * Channels that should get locked down when the lockdown command gets used. */ public get lockdownChannels(): Snowflake[] { - throw new Error('This should never be executed'); + throw new Error(NEVER_USED); } public set lockdownChannels(_: Snowflake[]) { - throw new Error('This should never be executed'); + throw new Error(NEVER_USED); } /** * Custom automod phases */ public get autoModPhases(): string[] { - throw new Error('This should never be executed'); + throw new Error(NEVER_USED); } public set autoModPhases(_: string[]) { - throw new Error('This should never be executed'); + throw new Error(NEVER_USED); } - static initModel(sequelize: Sequelize, client: BushClient): void { + public static initModel(sequelize: Sequelize, client: BushClient): void { Guild.init( { id: { @@ -150,7 +152,7 @@ export class Guild extends BaseModel<GuildModel, GuildModelCreationAttributes> i primaryKey: true }, prefix: { - type: DataTypes.STRING, + type: DataTypes.TEXT, allowNull: false, defaultValue: client.config.prefix }, diff --git a/src/lib/models/Level.ts b/src/lib/models/Level.ts index 309e6e6..ad64747 100644 --- a/src/lib/models/Level.ts +++ b/src/lib/models/Level.ts @@ -14,42 +14,47 @@ export interface LevelModelCreationAttributes { xp?: number; } +const NEVER_USED = 'This should never be executed'; + export class Level extends BaseModel<LevelModel, LevelModelCreationAttributes> { /** * The user's id. */ public get user(): Snowflake { - throw new Error('This should never be executed'); + throw new Error(NEVER_USED); } public set user(_: Snowflake) { - throw new Error('This should never be executed'); + throw new Error(NEVER_USED); } /** * The guild where the user is gaining xp. */ public get guild(): Snowflake { - throw new Error('This should never be executed'); + throw new Error(NEVER_USED); } public set guild(_: Snowflake) { - throw new Error('This should never be executed'); + throw new Error(NEVER_USED); } /** * The user's xp. */ public get xp(): number { - throw new Error('This should never be executed'); + throw new Error(NEVER_USED); } public set xp(_: number) { - throw new Error('This should never be executed'); + throw new Error(NEVER_USED); } + /** + * The user's level. + */ public get level(): number { return Level.convertXpToLevel(this.xp); } - static initModel(sequelize: Sequelize): void { + public static initModel(sequelize: Sequelize): void { Level.init( { user: { diff --git a/src/lib/models/ModLog.ts b/src/lib/models/ModLog.ts index 33c758f..5da6027 100644 --- a/src/lib/models/ModLog.ts +++ b/src/lib/models/ModLog.ts @@ -28,6 +28,7 @@ export interface ModLogModel { reason: string; duration: number; guild: Snowflake; + evidence: string; } export interface ModLogModelCreationAttributes { @@ -38,80 +39,93 @@ export interface ModLogModelCreationAttributes { reason?: string; duration?: number; guild: Snowflake; + evidence?: string; } +const NEVER_USED = 'This should never be executed'; + export class ModLog extends BaseModel<ModLogModel, ModLogModelCreationAttributes> implements ModLogModel { /** * The primary key of the modlog entry. */ public get id(): string { - throw new Error('This should never be executed'); + throw new Error(NEVER_USED); } public set id(_: string) { - throw new Error('This should never be executed'); + throw new Error(NEVER_USED); } /** * The type of punishment. */ public get type(): ModLogType { - throw new Error('This should never be executed'); + throw new Error(NEVER_USED); } public set type(_: ModLogType) { - throw new Error('This should never be executed'); + throw new Error(NEVER_USED); } /** * The user being punished. */ public get user(): Snowflake { - throw new Error('This should never be executed'); + throw new Error(NEVER_USED); } public set user(_: Snowflake) { - throw new Error('This should never be executed'); + throw new Error(NEVER_USED); } /** * The user carrying out the punishment. */ public get moderator(): Snowflake { - throw new Error('This should never be executed'); + throw new Error(NEVER_USED); } public set moderator(_: Snowflake) { - throw new Error('This should never be executed'); + throw new Error(NEVER_USED); } /** * The reason the user is getting punished */ public get reason(): string | null { - throw new Error('This should never be executed'); + throw new Error(NEVER_USED); } public set reason(_: string | null) { - throw new Error('This should never be executed'); + throw new Error(NEVER_USED); } /** * The amount of time the user is getting punished for. */ public get duration(): number | null { - throw new Error('This should never be executed'); + throw new Error(NEVER_USED); } public set duration(_: number | null) { - throw new Error('This should never be executed'); + throw new Error(NEVER_USED); } /** * The guild the user is getting punished in. */ public get guild(): Snowflake { - throw new Error('This should never be executed'); + throw new Error(NEVER_USED); } public set guild(_: Snowflake) { - throw new Error('This should never be executed'); + throw new Error(NEVER_USED); } - static initModel(sequelize: Sequelize): void { + /** + * Evidence of what the user is getting punished for. + */ + public get evidence(): string { + throw new Error(NEVER_USED); + } + public set evidence(_: string) { + throw new Error(NEVER_USED); + } + + public static initModel(sequelize: Sequelize): void { ModLog.init( { id: { @@ -137,7 +151,7 @@ export class ModLog extends BaseModel<ModLogModel, ModLogModelCreationAttributes allowNull: true }, reason: { - type: DataTypes.STRING, + type: DataTypes.TEXT, allowNull: true }, guild: { @@ -146,6 +160,10 @@ export class ModLog extends BaseModel<ModLogModel, ModLogModelCreationAttributes model: 'Guilds', key: 'id' } + }, + evidence: { + type: DataTypes.TEXT, + allowNull: true } }, { sequelize: sequelize } diff --git a/src/lib/models/StickyRole.ts b/src/lib/models/StickyRole.ts index 46650a4..b49af80 100644 --- a/src/lib/models/StickyRole.ts +++ b/src/lib/models/StickyRole.ts @@ -13,39 +13,40 @@ export interface StickyRoleModelCreationAttributes { roles: Snowflake[]; } +const NEVER_USED = 'This should never be executed'; + export class StickyRole extends BaseModel<StickyRoleModel, StickyRoleModelCreationAttributes> implements StickyRoleModel { /** * The id of the user the roles belongs to */ - public get user(): Snowflake { - throw new Error('This should never be executed'); + throw new Error(NEVER_USED); } public set user(_: Snowflake) { - throw new Error('This should never be executed'); + throw new Error(NEVER_USED); } /** * The guild where this should happen */ public get guild(): Snowflake { - throw new Error('This should never be executed'); + throw new Error(NEVER_USED); } public set guild(_: Snowflake) { - throw new Error('This should never be executed'); + throw new Error(NEVER_USED); } /** * The roles that the user should have returned */ public get roles(): Snowflake[] { - throw new Error('This should never be executed'); + throw new Error(NEVER_USED); } public set roles(_: Snowflake[]) { - throw new Error('This should never be executed'); + throw new Error(NEVER_USED); } - static initModel(sequelize: Sequelize): void { + public static initModel(sequelize: Sequelize): void { StickyRole.init( { user: { diff --git a/src/lib/utils/BushCache.ts b/src/lib/utils/BushCache.ts index f9def5e..cdf328b 100644 --- a/src/lib/utils/BushCache.ts +++ b/src/lib/utils/BushCache.ts @@ -1,15 +1,13 @@ import { Collection, Snowflake } from 'discord.js'; import { Guild } from '../models/Guild'; -class GlobalCache { - public static superUsers = new Array<Snowflake>(); - public static disabledCommands = new Array<string>(); - public static blacklistedChannels = new Array<Snowflake>(); - public static blacklistedGuilds = new Array<Snowflake>(); - public static blacklistedUsers = new Array<Snowflake>(); -} - export class BushCache { - public static global = GlobalCache; + public static global = { + superUsers: new Array<Snowflake>(), + disabledCommands: new Array<string>(), + blacklistedChannels: new Array<Snowflake>(), + blacklistedGuilds: new Array<Snowflake>(), + blacklistedUsers: new Array<Snowflake>() + }; public static guilds = new Collection<Snowflake, Guild>(); } diff --git a/src/lib/utils/BushConstants.ts b/src/lib/utils/BushConstants.ts index 97f86c4..391db75 100644 --- a/src/lib/utils/BushConstants.ts +++ b/src/lib/utils/BushConstants.ts @@ -186,36 +186,25 @@ export class BushConstants { maybeNitroDiscrims: ['1111', '2222', '3333', '4444', '5555', '6666', '6969', '7777', '8888', '9999'], + // prettier-ignore capes: [ - // supporter capes + /* supporter capes */ { name: 'patreon1', index: 0 }, { name: 'patreon2', index: 1 }, { name: 'fade', custom: 'https://raw.githubusercontent.com/NotEnoughUpdates/capes/master/fade.gif', index: 2 }, { name: 'lava', custom: 'https://raw.githubusercontent.com/NotEnoughUpdates/capes/master/lava.gif', index: 3 }, - { - name: 'mcworld', - custom: 'https://raw.githubusercontent.com/NotEnoughUpdates/capes/master/mcworld_compressed.gif', - index: 4 - }, - { - name: 'negative', - custom: 'https://raw.githubusercontent.com/NotEnoughUpdates/capes/master/negative_compressed.gif', - index: 5 - }, - { - name: 'space', - custom: 'https://raw.githubusercontent.com/NotEnoughUpdates/capes/master/space_compressed.gif', - index: 6 - }, + { name: 'mcworld', custom: 'https://raw.githubusercontent.com/NotEnoughUpdates/capes/master/mcworld_compressed.gif', index: 4 }, + { name: 'negative', custom: 'https://raw.githubusercontent.com/NotEnoughUpdates/capes/master/negative_compressed.gif', index: 5 }, + { name: 'space', custom: 'https://raw.githubusercontent.com/NotEnoughUpdates/capes/master/space_compressed.gif', index: 6 }, { name: 'void', custom: 'https://raw.githubusercontent.com/NotEnoughUpdates/capes/master/void.gif', index: 7 }, { name: 'tunnel', custom: 'https://raw.githubusercontent.com/NotEnoughUpdates/capes/master/tunnel.gif', index: 8 }, - // Staff capes + /* Staff capes */ { name: 'contrib', index: 9 }, { name: 'mbstaff', index: 10 }, { name: 'ironmoon', index: 11 }, { name: 'gravy', index: 12 }, { name: 'nullzee', index: 13 }, - // partner capes + /* partner capes */ { name: 'thebakery', index: 14 }, { name: 'dsm', index: 15 }, { name: 'packshq', index: 16 }, @@ -224,12 +213,16 @@ export class BushConstants { { name: 'sbp', index: 19 }, { name: 'subreddit_light', index: 20 }, { name: 'subreddit_dark', index: 21 }, - // streamer capes - { name: 'alexxoffi', index: 22 }, - { name: 'jakethybro', index: 23 }, - { name: 'krusty', index: 24 }, - { name: 'soldier', index: 25 }, - { name: 'zera', index: 26 } + {name : 'skyclient', index: 22 }, + /* streamer capes */ + { name: 'alexxoffi', index: 23 }, + { name: 'jakethybro', index: 24 }, + { name: 'krusty', index: 25 }, + { name: 'krusty_day', index: 26 }, + { name: 'krusty_night', index: 27 }, + { name: 'krusty_sunset', index: 28 }, + { name: 'soldier', index: 29 }, + { name: 'zera', index: 30 }, ], roleMap: [ { name: '*', id: '792453550768390194' }, diff --git a/src/lib/utils/BushLogger.ts b/src/lib/utils/BushLogger.ts index e7532d8..cf5969c 100644 --- a/src/lib/utils/BushLogger.ts +++ b/src/lib/utils/BushLogger.ts @@ -1,17 +1,12 @@ /* eslint-disable @typescript-eslint/no-explicit-any */ /* eslint-disable @typescript-eslint/explicit-module-boundary-types */ import chalk from 'chalk'; -import { MessageEmbed } from 'discord.js'; +import { MessageEmbed, Util } from 'discord.js'; import { inspect } from 'util'; -import { BushClient, BushSendMessageType } from '../extensions/discord-akairo/BushClient'; +import { BushSendMessageType } from '../extensions/discord-akairo/BushClient'; export class BushLogger { - private client: BushClient; - public constructor(client: BushClient) { - this.client = client; - } - - private parseFormatting( + static #parseFormatting( content: any, color: 'blueBright' | 'blackBright' | 'redBright' | 'yellowBright' | 'greenBright' | '', discordFormat = false @@ -21,22 +16,22 @@ export class BushLogger { const tempParsedArray: Array<string> = []; newContent.forEach((value, index) => { if (index % 2 !== 0) { - tempParsedArray.push(discordFormat ? `**${value}**` : chalk[color](value)); + tempParsedArray.push(discordFormat ? `**${Util.escapeMarkdown(value)}**` : chalk[color](value)); } else { - tempParsedArray.push(value); + tempParsedArray.push(Util.escapeMarkdown(value)); } }); return tempParsedArray.join(''); } - private inspectContent(content: any, depth = 2, colors = true): string { + static #inspectContent(content: any, depth = 2, colors = true): string { if (typeof content !== 'string') { return inspect(content, { depth, colors }); } return content; } - private stripColor(text: string): string { + static #stripColor(text: string): string { return text.replace( // eslint-disable-next-line no-control-regex /[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/g, @@ -44,7 +39,7 @@ export class BushLogger { ); } - private getTimeStamp(): string { + static #getTimeStamp(): string { const now = new Date(); const hours = now.getHours(); const minute = now.getMinutes(); @@ -64,18 +59,18 @@ export class BushLogger { * @param sendChannel - Should this also be logged to discord? Defaults to false. * @param depth - The depth the content will inspected. Defaults to 0. */ - public get log() { - return this.info; + public static get log() { + return BushLogger.info; } /** Sends a message to the log channel */ - public async channelLog(message: BushSendMessageType): Promise<void> { + public static async channelLog(message: BushSendMessageType): Promise<void> { const channel = await util.getConfigChannel('log'); await channel.send(message).catch(() => {}); } /** Sends a message to the error channel */ - public async channelError(message: BushSendMessageType): Promise<void> { + public static async channelError(message: BushSendMessageType): Promise<void> { const channel = await util.getConfigChannel('error'); await channel.send(message).catch(() => {}); } @@ -85,19 +80,19 @@ export class BushLogger { * @param content - The content to log. * @param depth - The depth the content will inspected. Defaults to 0. */ - public debug(content: any, depth = 0): void { + public static debug(content: any, depth = 0): void { if (!client.config.isDevelopment) return; - const newContent = this.inspectContent(content, depth, true); - console.log(`${chalk.bgMagenta(this.getTimeStamp())} ${chalk.magenta('[Debug]')}`, newContent); + const newContent = this.#inspectContent(content, depth, true); + console.log(`${chalk.bgMagenta(this.#getTimeStamp())} ${chalk.magenta('[Debug]')}`, newContent); } /** * Logs raw debug information. Only works in dev is enabled in the config. * @param content - The content to log. */ - public debugRaw(...content: any): void { + public static debugRaw(...content: any): void { if (!client.config.isDevelopment) return; - console.log(`${chalk.bgMagenta(this.getTimeStamp())} ${chalk.magenta('[Debug]')}`, ...content); + console.log(`${chalk.bgMagenta(this.#getTimeStamp())} ${chalk.magenta('[Debug]')}`, ...content); } /** @@ -107,15 +102,15 @@ export class BushLogger { * @param sendChannel - Should this also be logged to discord? Defaults to false. * @param depth - The depth the content will inspected. Defaults to 0. */ - public async verbose(header: string, content: any, sendChannel = false, depth = 0): Promise<void> { + public static async verbose(header: string, content: any, sendChannel = false, depth = 0): Promise<void> { if (!client.config.logging.verbose) return; - const newContent = this.inspectContent(content, depth, true); + const newContent = this.#inspectContent(content, depth, true); console.info( - `${chalk.bgGrey(this.getTimeStamp())} ${chalk.grey(`[${header}]`)} ` + this.parseFormatting(newContent, 'blackBright') + `${chalk.bgGrey(this.#getTimeStamp())} ${chalk.grey(`[${header}]`)} ` + this.#parseFormatting(newContent, 'blackBright') ); if (!sendChannel) return; const embed = new MessageEmbed() - .setDescription(`**[${header}]** ${this.parseFormatting(this.stripColor(newContent), '', true)}`) + .setDescription(`**[${header}]** ${this.#parseFormatting(this.#stripColor(newContent), '', true)}`) .setColor(util.colors.gray) .setTimestamp(); await this.channelLog({ embeds: [embed] }); @@ -128,15 +123,15 @@ export class BushLogger { * @param sendChannel - Should this also be logged to discord? Defaults to false. * @param depth - The depth the content will inspected. Defaults to 0. */ - public async info(header: string, content: any, sendChannel = true, depth = 0): Promise<void> { + public static async info(header: string, content: any, sendChannel = true, depth = 0): Promise<void> { if (!client.config.logging.info) return; - const newContent = this.inspectContent(content, depth, true); + const newContent = this.#inspectContent(content, depth, true); console.info( - `${chalk.bgCyan(this.getTimeStamp())} ${chalk.cyan(`[${header}]`)} ` + this.parseFormatting(newContent, 'blueBright') + `${chalk.bgCyan(this.#getTimeStamp())} ${chalk.cyan(`[${header}]`)} ` + this.#parseFormatting(newContent, 'blueBright') ); if (!sendChannel) return; const embed = new MessageEmbed() - .setDescription(`**[${header}]** ${this.parseFormatting(this.stripColor(newContent), '', true)}`) + .setDescription(`**[${header}]** ${this.#parseFormatting(this.#stripColor(newContent), '', true)}`) .setColor(util.colors.info) .setTimestamp(); await this.channelLog({ embeds: [embed] }); @@ -149,16 +144,16 @@ export class BushLogger { * @param sendChannel - Should this also be logged to discord? Defaults to false. * @param depth - The depth the content will inspected. Defaults to 0. */ - public async warn(header: string, content: any, sendChannel = true, depth = 0): Promise<void> { - const newContent = this.inspectContent(content, depth, true); + public static async warn(header: string, content: any, sendChannel = true, depth = 0): Promise<void> { + const newContent = this.#inspectContent(content, depth, true); console.warn( - `${chalk.bgYellow(this.getTimeStamp())} ${chalk.yellow(`[${header}]`)} ` + - this.parseFormatting(newContent, 'yellowBright') + `${chalk.bgYellow(this.#getTimeStamp())} ${chalk.yellow(`[${header}]`)} ` + + this.#parseFormatting(newContent, 'yellowBright') ); if (!sendChannel) return; const embed = new MessageEmbed() - .setDescription(`**[${header}]** ${this.parseFormatting(this.stripColor(newContent), '', true)}`) + .setDescription(`**[${header}]** ${this.#parseFormatting(this.#stripColor(newContent), '', true)}`) .setColor(util.colors.warn) .setTimestamp(); await this.channelLog({ embeds: [embed] }); @@ -171,15 +166,15 @@ export class BushLogger { * @param sendChannel - Should this also be logged to discord? Defaults to false. * @param depth - The depth the content will inspected. Defaults to 0. */ - public async error(header: string, content: any, sendChannel = true, depth = 0): Promise<void> { - const newContent = this.inspectContent(content, depth, true); + public static async error(header: string, content: any, sendChannel = true, depth = 0): Promise<void> { + const newContent = this.#inspectContent(content, depth, true); console.error( - `${chalk.bgRedBright(this.getTimeStamp())} ${chalk.redBright(`[${header}]`)} ` + - this.parseFormatting(newContent, 'redBright') + `${chalk.bgRedBright(this.#getTimeStamp())} ${chalk.redBright(`[${header}]`)} ` + + this.#parseFormatting(newContent, 'redBright') ); if (!sendChannel) return; const embed = new MessageEmbed() - .setDescription(`**[${header}]** ${this.parseFormatting(this.stripColor(newContent), '', true)}`) + .setDescription(`**[${header}]** ${this.#parseFormatting(this.#stripColor(newContent), '', true)}`) .setColor(util.colors.error) .setTimestamp(); await this.channelError({ embeds: [embed] }); @@ -192,15 +187,15 @@ export class BushLogger { * @param sendChannel - Should this also be logged to discord? Defaults to false. * @param depth - The depth the content will inspected. Defaults to 0. */ - public async success(header: string, content: any, sendChannel = true, depth = 0): Promise<void> { - const newContent = this.inspectContent(content, depth, true); + public static async success(header: string, content: any, sendChannel = true, depth = 0): Promise<void> { + const newContent = this.#inspectContent(content, depth, true); console.log( - `${chalk.bgGreen(this.getTimeStamp())} ${chalk.greenBright(`[${header}]`)} ` + - this.parseFormatting(newContent, 'greenBright') + `${chalk.bgGreen(this.#getTimeStamp())} ${chalk.greenBright(`[${header}]`)} ` + + this.#parseFormatting(newContent, 'greenBright') ); if (!sendChannel) return; const embed = new MessageEmbed() - .setDescription(`**[${header}]** ${this.parseFormatting(this.stripColor(newContent), '', true)}`) + .setDescription(`**[${header}]** ${this.#parseFormatting(this.#stripColor(newContent), '', true)}`) .setColor(util.colors.success) .setTimestamp(); await this.channelLog({ embeds: [embed] }).catch(() => {}); diff --git a/src/listeners/message/blacklistedFile.ts b/src/listeners/message/blacklistedFile.ts index 741b508..36bf2e9 100644 --- a/src/listeners/message/blacklistedFile.ts +++ b/src/listeners/message/blacklistedFile.ts @@ -4,7 +4,7 @@ import { BushListener } from '../../lib'; import { BushClientEvents } from '../../lib/extensions/discord.js/BushClientEvents'; export default class BlacklistedFileListener extends BushListener { - private blacklistedFiles: { hash: string[]; name: string; description: string }[] = [ + #blacklistedFiles: { hash: string[]; name: string; description: string }[] = [ { hash: ['a0f5e30426234bc9d09306ffc9474422'], name: 'Play twice audio', @@ -86,7 +86,7 @@ export default class BlacklistedFileListener extends BushListener { const rawHash = crypto.createHash('md5'); rawHash.update(req.rawBody.toString('binary')); const hash = rawHash.digest('hex'); - const blacklistData = this.blacklistedFiles.find((h) => h.hash.some((h) => h === hash)); + const blacklistData = this.#blacklistedFiles.find((h) => h.hash.some((h) => h === hash)); if (blacklistData !== undefined) { foundFiles.push(blacklistData); } @@ -100,7 +100,7 @@ export default class BlacklistedFileListener extends BushListener { const rawHash = crypto.createHash('md5'); rawHash.update(req.rawBody.toString('binary')); const hash = rawHash.digest('hex'); - const blacklistData = this.blacklistedFiles.find((h) => h.hash.some((h) => h === hash)); + const blacklistData = this.#blacklistedFiles.find((h) => h.hash.some((h) => h === hash)); if (blacklistData !== undefined) { foundFiles.push(blacklistData); } @@ -116,7 +116,7 @@ export default class BlacklistedFileListener extends BushListener { const rawHash = crypto.createHash('md5'); rawHash.update(req.rawBody.toString('binary')); const hash = rawHash.digest('hex'); - const blacklistData = this.blacklistedFiles.find((h) => h.hash.some((h) => h === hash)); + const blacklistData = this.#blacklistedFiles.find((h) => h.hash.some((h) => h === hash)); if (blacklistData !== undefined) { foundFiles.push(blacklistData); } diff --git a/src/listeners/message/level.ts b/src/listeners/message/level.ts index db4be4b..f5fb932 100644 --- a/src/listeners/message/level.ts +++ b/src/listeners/message/level.ts @@ -2,8 +2,8 @@ import { BushCommandHandlerEvents, BushListener, Level } from '@lib'; import { MessageType } from 'discord.js'; export default class LevelListener extends BushListener { - private levelCooldowns: Set<string> = new Set(); - private blacklistedChannels = ['702456294874808330']; + #levelCooldowns: Set<string> = new Set(); + #blacklistedChannels = ['702456294874808330']; public constructor() { super('level', { emitter: 'commandHandler', @@ -16,8 +16,8 @@ export default class LevelListener extends BushListener { if (!message.author) return; if (!message.guild) return; if (message.util?.parsed?.command) return; - if (this.levelCooldowns.has(`${message.guild.id}-${message.author.id}`)) return; - if (this.blacklistedChannels.includes(message.channel.id)) return; + if (this.#levelCooldowns.has(`${message.guild.id}-${message.author.id}`)) return; + if (this.#blacklistedChannels.includes(message.channel.id)) return; const allowedMessageTypes: MessageType[] = ['DEFAULT', 'REPLY']; // this is so ts will yell at me when discord.js makes some unnecessary breaking change if (!allowedMessageTypes.includes(message.type)) return; //checks for join messages, slash commands, booster messages etc const [user] = await Level.findOrBuild({ @@ -41,7 +41,7 @@ export default class LevelListener extends BushListener { `LevelMessageListener`, `Gave <<${xpToGive}>> XP to <<${message.author.tag}>> in <<${message.guild}>>.` ); - this.levelCooldowns.add(`${message.guild.id}-${message.author.id}`); - setTimeout(() => this.levelCooldowns.delete(`${message.guild.id}-${message.author.id}`), 60_000); + this.#levelCooldowns.add(`${message.guild.id}-${message.author.id}`); + setTimeout(() => this.#levelCooldowns.delete(`${message.guild.id}-${message.author.id}`), 60_000); } } diff --git a/src/tasks/updateCache.ts b/src/tasks/updateCache.ts index 95ceca1..910088f 100644 --- a/src/tasks/updateCache.ts +++ b/src/tasks/updateCache.ts @@ -13,13 +13,13 @@ export class UpdateCacheTask extends BushTask { } public override async exec(): Promise<void> { await UpdateCacheTask.updateGlobalCache(client); - await UpdateCacheTask.updateGuildCache(client); + await UpdateCacheTask.#updateGuildCache(client); void client.logger.verbose(`UpdateCache`, `Updated cache.`); } public static async init(client: BushClient): Promise<void> { await UpdateCacheTask.updateGlobalCache(client); - await UpdateCacheTask.updateGuildCache(client); + await UpdateCacheTask.#updateGuildCache(client); } private static async updateGlobalCache(client: BushClient): Promise<void> { @@ -41,7 +41,7 @@ export class UpdateCacheTask extends BushTask { } } - private static async updateGuildCache(client: BushClient): Promise<void> { + static async #updateGuildCache(client: BushClient): Promise<void> { const rows = await Guild.findAll(); for (const row of rows) { client.cache.guilds.set(row.id, row.toJSON() as Guild); diff --git a/tsconfig.json b/tsconfig.json index 5368567..c40a7e2 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -3,7 +3,7 @@ "module": "commonjs", "target": "esnext", "outDir": "dist", - "lib": ["ESNext", "ESNext.Array", "ESNext.AsyncIterable", "ESNext.Intl", "ESNext.Symbol", "DOM"], + "lib": ["esnext", "esnext.array", "esnext.asyncIterable", "esnext.intl", "esnext.symbol", "DOM"], "sourceMap": false, "inlineSourceMap": true, "inlineSources": true, @@ -13,6 +13,8 @@ "emitDecoratorMetadata": true, "resolveJsonModule": true, "noImplicitOverride": true, + "alwaysStrict": true, + "noErrorTruncation": true, "baseUrl": "./", "paths": { "src/*": ["./src/*"], @@ -14,10 +14,10 @@ __metadata: languageName: node linkType: hard -"@babel/helper-validator-identifier@npm:^7.14.5, @babel/helper-validator-identifier@npm:^7.14.8": - version: 7.14.8 - resolution: "@babel/helper-validator-identifier@npm:7.14.8" - checksum: f21ad9a9f0a66a02e0e5f62d505cbeb9e01a7ac5bd34be0af9f916f0b6d8d40718efaf51b656b41759e3454703090b4d386105f1f97f6598ee5a3f8eb98adc6a +"@babel/helper-validator-identifier@npm:^7.14.5, @babel/helper-validator-identifier@npm:^7.14.9": + version: 7.14.9 + resolution: "@babel/helper-validator-identifier@npm:7.14.9" + checksum: 58552531a7674363e74672434c312ddaf1545b8a43308e1a7f38db58bf79c796c095a6dab6a6105eb0d783b97441f6cbb525bb887f29a35f232fcdbd8cb240dc languageName: node linkType: hard @@ -33,31 +33,34 @@ __metadata: linkType: hard "@babel/parser@npm:^7.0.0": - version: 7.14.8 - resolution: "@babel/parser@npm:7.14.8" + version: 7.15.0 + resolution: "@babel/parser@npm:7.15.0" bin: parser: ./bin/babel-parser.js - checksum: 9e532b2bbe690fff8cdaf8c25cfecb684ebe9e9d50d30cd775852dd711649ddb964368b26fda55786404fadf500f944043fb0f731b765104ad857d677dd29ce5 + checksum: f9739478b91d2c151246b5d61399d22ba2139897e979d7bfe62d9cafce6337f007ebf662933c950ad4f18858d1d25a44a9ad22157ce1870dbe6b356f0cdebe8f languageName: node linkType: hard "@babel/types@npm:^7.8.3": - version: 7.14.8 - resolution: "@babel/types@npm:7.14.8" + version: 7.15.0 + resolution: "@babel/types@npm:7.15.0" dependencies: - "@babel/helper-validator-identifier": ^7.14.8 + "@babel/helper-validator-identifier": ^7.14.9 to-fast-properties: ^2.0.0 - checksum: d4ebd2e0e52f05cbcb3ded434d9fb49db73c239d98c4f7bd27beaf32fcd7c81aa30618237e87d53505d5e65fd20d688cb4237b6fa927a04831129a6044f2e4b5 + checksum: 6d6bcdfce94b5446520a24087c6dede453e28425af092965b304d4028e9bca79712fd691cdad031e3570c7667bf3206e5f642bcccbfccb33d42ca4a8203587f9 languageName: node linkType: hard -"@discordjs/builders@npm:^0.2.0": - version: 0.2.0 - resolution: "@discordjs/builders@npm:0.2.0" +"@discordjs/builders@npm:^0.3.0": + version: 0.3.0 + resolution: "@discordjs/builders@npm:0.3.0" dependencies: - discord-api-types: ^0.18.1 + "@sindresorhus/is": ^4.0.1 + discord-api-types: ^0.22.0 + ow: ^0.26.0 + ts-mixer: ^5.4.1 tslib: ^2.3.0 - checksum: 820067c4d441913805fb728c63d5ba14db9024ddd8ee4fb580a62b92bcb0f77a0b9e8c7f3a6ebb4c987cade0696837cf8f1f447920e9a40606314ef3ddef7a5d + checksum: 455682a4de07057e92f80513c533634be169af09ff272901582f6c00b004032b0bd8b000083e614d754f171911071bafe6011a443e558e831051a7204e918580 languageName: node linkType: hard @@ -190,7 +193,7 @@ __metadata: languageName: node linkType: hard -"@sindresorhus/is@npm:^4.0.0": +"@sindresorhus/is@npm:^4.0.0, @sindresorhus/is@npm:^4.0.1": version: 4.0.1 resolution: "@sindresorhus/is@npm:4.0.1" checksum: 92ae3f3d765bd5bc7355852cb9852091ebce6a76bb00eeb37d08e0247b9b3e742eae43ff3753de0c0c00876c526613db6433c9594ae0d17b305b3d6dbeef2514 @@ -289,9 +292,9 @@ __metadata: linkType: hard "@types/json-schema@npm:^7.0.7": - version: 7.0.8 - resolution: "@types/json-schema@npm:7.0.8" - checksum: f1d0fe76ab1db93846f36a9179faa44b9b66f2f5f44597e46e65456a1c998f632c63b94ed347058ed1a230cbf95a9a164b4daf4d70aa3d651d5033f7856df83c + version: 7.0.9 + resolution: "@types/json-schema@npm:7.0.9" + checksum: 259d0e25f11a21ba5c708f7ea47196bd396e379fddb79c76f9f4f62c945879dc21657904914313ec2754e443c5018ea8372362f323f30e0792897fdb2098a705 languageName: node linkType: hard @@ -329,16 +332,16 @@ __metadata: linkType: hard "@types/node@npm:*": - version: 16.4.8 - resolution: "@types/node@npm:16.4.8" - checksum: 1d4a421b95ac4d7671de17c56969bf95943c252c410dbe33c380e97a8afdfa7c2e5dcda0063a5c24fcc5538f40ef33c2582ae37f004c3c666da3758d8c8eecfc + version: 16.4.12 + resolution: "@types/node@npm:16.4.12" + checksum: 1489aeba890629ca2ed9b8f04fb77f185123810afd3d518cf87c2a18a43a43f7d954550ae3572f3dac7e634f7db67e259ceb7ca25cb584ba0bcc023b0bfca2c9 languageName: node linkType: hard "@types/node@npm:^14.14.22": - version: 14.17.6 - resolution: "@types/node@npm:14.17.6" - checksum: 19b11f3c49689d1ffd2b7b534a49ab7daca18ce702cce9d9b5d28d60e79de94367339217f602053d0353170a9e02f7ad2d5cd796200977dc176d6d7ba376cf09 + version: 14.17.9 + resolution: "@types/node@npm:14.17.9" + checksum: e59b92e4346ed0db61e042d439f9658d1d3e8ad1d14825b714804cafae8ce22220ff6c8d907c4e4c6384aac748de07283fa321ef13cb8bdeb460eb789d634244 languageName: node linkType: hard @@ -399,11 +402,11 @@ __metadata: linkType: hard "@typescript-eslint/eslint-plugin@npm:^4.14.1": - version: 4.28.5 - resolution: "@typescript-eslint/eslint-plugin@npm:4.28.5" + version: 4.29.0 + resolution: "@typescript-eslint/eslint-plugin@npm:4.29.0" dependencies: - "@typescript-eslint/experimental-utils": 4.28.5 - "@typescript-eslint/scope-manager": 4.28.5 + "@typescript-eslint/experimental-utils": 4.29.0 + "@typescript-eslint/scope-manager": 4.29.0 debug: ^4.3.1 functional-red-black-tree: ^1.0.1 regexpp: ^3.1.0 @@ -415,66 +418,66 @@ __metadata: peerDependenciesMeta: typescript: optional: true - checksum: 8d9147ecca2978e5e0674e33ed20f8183db6932f7005169ef88075f8446efdfe47eef83cd5917bc59db22df794e495d65716fefa248d10fb2900c3135fceaed9 + checksum: eed42b03c31410126f1cccaf4e97676c2a678ca1ce4d1a5d47b909707fcfc9fd08b398b34fe7bc5919f7b922e1062815a02d7cceef6457a0dbe67c9b30a9b39f languageName: node linkType: hard -"@typescript-eslint/experimental-utils@npm:4.28.5": - version: 4.28.5 - resolution: "@typescript-eslint/experimental-utils@npm:4.28.5" +"@typescript-eslint/experimental-utils@npm:4.29.0": + version: 4.29.0 + resolution: "@typescript-eslint/experimental-utils@npm:4.29.0" dependencies: "@types/json-schema": ^7.0.7 - "@typescript-eslint/scope-manager": 4.28.5 - "@typescript-eslint/types": 4.28.5 - "@typescript-eslint/typescript-estree": 4.28.5 + "@typescript-eslint/scope-manager": 4.29.0 + "@typescript-eslint/types": 4.29.0 + "@typescript-eslint/typescript-estree": 4.29.0 eslint-scope: ^5.1.1 eslint-utils: ^3.0.0 peerDependencies: eslint: "*" - checksum: 91ea6f703a4eb1c36773a50aca61b63f05f5ed86a65f47f1a20c83027135e8e95b34953701132f8df039f1a75f23d9bce6a8062d531fdcf6d62f6192c9a58462 + checksum: 1c1daddb9b0464d8df422b598cecd4e931fe40109b9f43067c00aa5fd0a046c2bfc06e82da6ba27d667cb4f12964c21521027c4fec886a97285e6b5a0b3fe943 languageName: node linkType: hard "@typescript-eslint/parser@npm:^4.14.1": - version: 4.28.5 - resolution: "@typescript-eslint/parser@npm:4.28.5" + version: 4.29.0 + resolution: "@typescript-eslint/parser@npm:4.29.0" dependencies: - "@typescript-eslint/scope-manager": 4.28.5 - "@typescript-eslint/types": 4.28.5 - "@typescript-eslint/typescript-estree": 4.28.5 + "@typescript-eslint/scope-manager": 4.29.0 + "@typescript-eslint/types": 4.29.0 + "@typescript-eslint/typescript-estree": 4.29.0 debug: ^4.3.1 peerDependencies: eslint: ^5.0.0 || ^6.0.0 || ^7.0.0 peerDependenciesMeta: typescript: optional: true - checksum: badd2d294742c4640523134d5eb72157631073b6ba02fd165cbbd1d78394f4ccdfdb8a98be539d90b1739f4b3fcbfcc8d5cb00e89ad048e8738cd3c4d2b9b807 + checksum: 78d1a558dc92e6baeef3b0bb6850108d3bb792282646678e276626b940b07e601d35abd790f8f02cb4625fe1656c57c9a7ae776c731984f36ab886cb93ed3b26 languageName: node linkType: hard -"@typescript-eslint/scope-manager@npm:4.28.5": - version: 4.28.5 - resolution: "@typescript-eslint/scope-manager@npm:4.28.5" +"@typescript-eslint/scope-manager@npm:4.29.0": + version: 4.29.0 + resolution: "@typescript-eslint/scope-manager@npm:4.29.0" dependencies: - "@typescript-eslint/types": 4.28.5 - "@typescript-eslint/visitor-keys": 4.28.5 - checksum: bde38033295c5e6c04f3c4852a7dd42758f7abdacb58eae2f3b8f7e4163bfc0960be985116caff179e3b0f0116a065007e3ccde8d159ca49710d21bab65e4e27 + "@typescript-eslint/types": 4.29.0 + "@typescript-eslint/visitor-keys": 4.29.0 + checksum: 3f3d211ae56a0b35e21d16dca4be5d8599928eb97045d191e2ab8065b90312b92c0b15a9c37dc2022056a1be3a2aa83ff704f3ecf41155df772951e12dc341bc languageName: node linkType: hard -"@typescript-eslint/types@npm:4.28.5": - version: 4.28.5 - resolution: "@typescript-eslint/types@npm:4.28.5" - checksum: 54e75890b01949614c9bf11e30cc9da87189fe3d834b39e767202276d7d7a60891d31bb52576c64fa4df4846f61e67e73ac958f90127024fd9fa1709d3df3041 +"@typescript-eslint/types@npm:4.29.0": + version: 4.29.0 + resolution: "@typescript-eslint/types@npm:4.29.0" + checksum: ce42a50ba69f6eaa83661b752132ddd058a619025dfccf16f1cc4e21dcfda57787e2bce106b2396cc7ebf6b29473460f90ac12d277a2115c1a9000b6236fcfcb languageName: node linkType: hard -"@typescript-eslint/typescript-estree@npm:4.28.5, @typescript-eslint/typescript-estree@npm:^4.8.2": - version: 4.28.5 - resolution: "@typescript-eslint/typescript-estree@npm:4.28.5" +"@typescript-eslint/typescript-estree@npm:4.29.0, @typescript-eslint/typescript-estree@npm:^4.8.2": + version: 4.29.0 + resolution: "@typescript-eslint/typescript-estree@npm:4.29.0" dependencies: - "@typescript-eslint/types": 4.28.5 - "@typescript-eslint/visitor-keys": 4.28.5 + "@typescript-eslint/types": 4.29.0 + "@typescript-eslint/visitor-keys": 4.29.0 debug: ^4.3.1 globby: ^11.0.3 is-glob: ^4.0.1 @@ -483,17 +486,17 @@ __metadata: peerDependenciesMeta: typescript: optional: true - checksum: a63847b676c265b9cd1d5370f99ed9049940b42369815c20d768e655ebf7f1af3521e00f9c3e31133bd1848d0290468aa58b1822c0941af02243c3cff089dac1 + checksum: e1f893c2dff1bb2eb800039871ba08a9d96d8d3ca976389426df8e75438031afa443b863925582fa610d19c40d4b9a787d130ed8bcf11c4aeb2cb63c78d592c3 languageName: node linkType: hard -"@typescript-eslint/visitor-keys@npm:4.28.5": - version: 4.28.5 - resolution: "@typescript-eslint/visitor-keys@npm:4.28.5" +"@typescript-eslint/visitor-keys@npm:4.29.0": + version: 4.29.0 + resolution: "@typescript-eslint/visitor-keys@npm:4.29.0" dependencies: - "@typescript-eslint/types": 4.28.5 + "@typescript-eslint/types": 4.29.0 eslint-visitor-keys: ^2.0.0 - checksum: 77fa439f4ae8fbdb4923e34c0aac9b567216becfa848490ae51d15b578431b8f54c083570dd6c8472d57a492d14aa6d426be34364195538ee1072d91a63616f4 + checksum: 3be974c6b2dd4eee3dbe01409bd6bf0e175bac5fe42df4256782ad1a4b05aded64bee711f0b6e597f732b1b506f72c25f7415370211af4b526557e872fc7f94b languageName: node linkType: hard @@ -805,6 +808,7 @@ __metadata: chalk: ^4.1.1 common-tags: ^1.8.0 discord-akairo: NotEnoughUpdates/discord-akairo + discord-akairo-message-util: NotEnoughUpdates/discord-akairo-message-util discord-api-types: 0.21.0 discord.js: NotEnoughUpdates/discord.js discord.js-minesweeper: ^1.0.6 @@ -827,6 +831,11 @@ __metadata: tinycolor2: ^1.4.2 typescript: ^4.3.5 uuid: ^8.3.2 + dependenciesMeta: + discord-akairo-message-util@1.0.0: + unplugged: true + discord-akairo@8.2.2: + unplugged: true languageName: unknown linkType: soft @@ -884,7 +893,7 @@ __metadata: languageName: node linkType: hard -"callsites@npm:^3.0.0": +"callsites@npm:^3.0.0, callsites@npm:^3.1.0": version: 3.1.0 resolution: "callsites@npm:3.1.0" checksum: 072d17b6abb459c2ba96598918b55868af677154bec7e73d222ef95a8fdb9bbf7dae96a8421085cdad8cd190d86653b5b6dc55a4484f2e5b2e27d5e0c3fc15b3 @@ -1333,14 +1342,23 @@ __metadata: languageName: node linkType: hard +discord-akairo-message-util@NotEnoughUpdates/discord-akairo-message-util: + version: 1.0.0 + resolution: "discord-akairo-message-util@https://github.com/NotEnoughUpdates/discord-akairo-message-util.git#commit=0c3338058b32ee5cb5b410a148fbcb70c9ba8fde" + checksum: bd6bbd7e1a1afdda652de26d168c0df33083571992651ea3e7b96f573524b6d6ac977bec7c245c086cccebe62b8fd190954ad95253721fccbdfcb4deb39e64cb + languageName: node + linkType: hard + discord-akairo@NotEnoughUpdates/discord-akairo: version: 8.2.2 - resolution: "discord-akairo@https://github.com/NotEnoughUpdates/discord-akairo.git#commit=746c4137954c8582a6616c3c1672340661391dbf" - checksum: 563932ada8d9ddc85e2e954289bb7cab3c7dcbddf0a22b52d02b26d4ecf0ddc7e172c4316b405d85cf006185518e0442c6273b880666069bdf5961b9f251c91b + resolution: "discord-akairo@https://github.com/NotEnoughUpdates/discord-akairo.git#commit=9a48bd17f3d88fcadbdd667b6b543ae16bc390c2" + dependencies: + discord-akairo-message-util: NotEnoughUpdates/discord-akairo-message-util + checksum: 2dddf0d1717b3f4ecaa0d9fba1489a3c0227b4cad13207bc586b2b83c2d8e3a633ad2cdb1d36edde261bf010eb68b450f3524ad8ee9e52a198e1645a2282168e languageName: node linkType: hard -"discord-api-types@npm:0.21.0, discord-api-types@npm:^0.21.0": +"discord-api-types@npm:0.21.0": version: 0.21.0 resolution: "discord-api-types@npm:0.21.0" checksum: 00872f1c453964d86579e59a6aa57fc7b2025b84bf7168fb4dad1d8e218db09dc78c20758ef9e15135bbfc76c9bf51102e671c0a20530e552ad7fc6f93a971c3 @@ -1354,6 +1372,13 @@ discord-akairo@NotEnoughUpdates/discord-akairo: languageName: node linkType: hard +"discord-api-types@npm:^0.22.0": + version: 0.22.0 + resolution: "discord-api-types@npm:0.22.0" + checksum: 673bcd960e394d8a3752bb03d50de44e74d508450e3d2cce947a69e0a6dc43c00196e18245c88dd26f3a8b0a56b40e0dbf52e058b7aabc7ed77f0f018003cb04 + languageName: node + linkType: hard + "discord.js-minesweeper@npm:^1.0.6": version: 1.0.6 resolution: "discord.js-minesweeper@npm:1.0.6" @@ -1363,18 +1388,18 @@ discord-akairo@NotEnoughUpdates/discord-akairo: discord.js@NotEnoughUpdates/discord.js: version: 13.0.0-dev - resolution: "discord.js@https://github.com/NotEnoughUpdates/discord.js.git#commit=9db7fcc931d5cd1ef57fa5ee61e5fc2072dc1822" + resolution: "discord.js@https://github.com/NotEnoughUpdates/discord.js.git#commit=d118277c618fdb08a15b90e3d342e5651befdee1" dependencies: - "@discordjs/builders": ^0.2.0 + "@discordjs/builders": ^0.3.0 "@discordjs/collection": ^0.2.1 "@discordjs/form-data": ^3.0.1 "@sapphire/async-queue": ^1.1.4 "@types/ws": ^7.4.5 abort-controller: ^3.0.0 - discord-api-types: ^0.21.0 + discord-api-types: ^0.22.0 node-fetch: ^2.6.1 ws: ^7.5.1 - checksum: 638680bfa8c5e3dd6fd0c22d68bddf190211e4c0e18cf833e68a51a84e9a9419b52616ae146e95546e750cd8a4243c813e54ec6df16777ecb1e36e1e8071a6f1 + checksum: f854feb2ac0cdbf4171d593171b05d7a23a7fdab1d3f94cf20bf8dde1e97468da312c7152cd965910fd1c330d58de5d2943a6007ea482f4fa6ea0778d1a0aaf2 languageName: node linkType: hard @@ -1387,6 +1412,15 @@ discord.js@NotEnoughUpdates/discord.js: languageName: node linkType: hard +"dot-prop@npm:^6.0.1": + version: 6.0.1 + resolution: "dot-prop@npm:6.0.1" + dependencies: + is-obj: ^2.0.0 + checksum: 0f47600a4b93e1dc37261da4e6909652c008832a5d3684b5bf9a9a0d3f4c67ea949a86dceed9b72f5733ed8e8e6383cc5958df3bbd0799ee317fd181f2ece700 + languageName: node + linkType: hard + "dottie@npm:^2.0.0": version: 2.0.2 resolution: "dottie@npm:2.0.2" @@ -2258,6 +2292,13 @@ discord.js@NotEnoughUpdates/discord.js: languageName: node linkType: hard +"is-obj@npm:^2.0.0": + version: 2.0.0 + resolution: "is-obj@npm:2.0.0" + checksum: c9916ac8f4621962a42f5e80e7ffdb1d79a3fab7456ceaeea394cd9e0858d04f985a9ace45be44433bf605673c8be8810540fe4cc7f4266fc7526ced95af5a08 + languageName: node + linkType: hard + "is-regexp@npm:^1.0.0": version: 1.0.0 resolution: "is-regexp@npm:1.0.0" @@ -2390,6 +2431,13 @@ discord.js@NotEnoughUpdates/discord.js: languageName: node linkType: hard +"lodash.isequal@npm:^4.5.0": + version: 4.5.0 + resolution: "lodash.isequal@npm:4.5.0" + checksum: da27515dc5230eb1140ba65ff8de3613649620e8656b19a6270afe4866b7bd461d9ba2ac8a48dcc57f7adac4ee80e1de9f965d89d4d81a0ad52bb3eec2609644 + languageName: node + linkType: hard + "lodash.merge@npm:^4.6.2": version: 4.6.2 resolution: "lodash.merge@npm:4.6.2" @@ -2736,11 +2784,11 @@ discord.js@NotEnoughUpdates/discord.js: linkType: hard "nan@npm:^2.14.0": - version: 2.14.2 - resolution: "nan@npm:2.14.2" + version: 2.15.0 + resolution: "nan@npm:2.15.0" dependencies: node-gyp: latest - checksum: 7a269139b66a7d37470effb7fb36a8de8cc3b5ffba6e40bb8e0545307911fe5ebf94797ec62f655ecde79c237d169899f8bd28256c66a32cbc8284faaf94c3f4 + checksum: 33e1bb4dfca447fe37d4bb5889be55de154828632c8d38646db67293a21afd61ed9909cdf1b886214a64707d935926c4e60e2b09de9edfc2ad58de31d6ce8f39 languageName: node linkType: hard @@ -2912,6 +2960,20 @@ discord.js@NotEnoughUpdates/discord.js: languageName: node linkType: hard +"ow@npm:^0.26.0": + version: 0.26.0 + resolution: "ow@npm:0.26.0" + dependencies: + "@sindresorhus/is": ^4.0.1 + callsites: ^3.1.0 + dot-prop: ^6.0.1 + lodash.isequal: ^4.5.0 + type-fest: ^1.2.1 + vali-date: ^1.0.0 + checksum: f8357d5180d3edfa3ddbc029e18aa1fd7d7e987e4c3cd22eaa924fa6a729595d7578332d79747b17ab094b9aee0269a5e1cb966c018a95fcb2490fd6b23a3efb + languageName: node + linkType: hard + "p-cancelable@npm:^2.0.0": version: 2.1.1 resolution: "p-cancelable@npm:2.1.1" @@ -3884,8 +3946,8 @@ resolve@^1.19.0: linkType: hard "tar@npm:^6.0.2, tar@npm:^6.1.0": - version: 6.1.2 - resolution: "tar@npm:6.1.2" + version: 6.1.6 + resolution: "tar@npm:6.1.6" dependencies: chownr: ^2.0.0 fs-minipass: ^2.0.0 @@ -3893,7 +3955,7 @@ resolve@^1.19.0: minizlib: ^2.1.1 mkdirp: ^1.0.3 yallist: ^4.0.0 - checksum: 13c9b26b22b26b321e842f024fd56831e26fd455cceface3827f2034d1027ad1e9c59b75a98e30a19171b1b5047526d517ec6bf38d2d7bb6bb8d496d7ff239af + checksum: 583f1165281746b4c48adee4ff7bab4895e73999eeda3c8d59779e47c29dc1dc714d832608a491fead4fd794bf9e0bd51b3d4a4fbad87f487a8b360321d70e8c languageName: node linkType: hard @@ -3955,6 +4017,13 @@ resolve@^1.19.0: languageName: node linkType: hard +"ts-mixer@npm:^5.4.1": + version: 5.4.1 + resolution: "ts-mixer@npm:5.4.1" + checksum: 867b23ca960270214fe8a88c4f24447695998b015df770e4832525f24d3263c38f98201d9c8758bb70dbea2eb79b986305fb38f1f6f14404acf1629f96be08a1 + languageName: node + linkType: hard + "tslib@npm:^1.8.1": version: 1.14.1 resolution: "tslib@npm:1.14.1" @@ -4005,6 +4074,13 @@ resolve@^1.19.0: languageName: node linkType: hard +"type-fest@npm:^1.2.1": + version: 1.3.0 + resolution: "type-fest@npm:1.3.0" + checksum: c5f897c8d88ddf2f3f14743d7af6d1ce62aa957c6540349ef2e0444839dc26a81c1a41309d115d1cfa1f1c5e0a3a84f0798ee3312b6bdedef2c2c4e9448c4ea0 + languageName: node + linkType: hard + "type-is@npm:~1.6.17": version: 1.6.18 resolution: "type-is@npm:1.6.18" @@ -4126,6 +4202,13 @@ typescript@^4.3.5: languageName: node linkType: hard +"vali-date@npm:^1.0.0": + version: 1.0.0 + resolution: "vali-date@npm:1.0.0" + checksum: 6464369cb77003a966591f2bd17b7c938c480956992e254b3455fd1651a3b7633e23aac8a03b974bbdfbd2357da52b98d46357bb6f292ffd28768a6d3959e61e + languageName: node + linkType: hard + "validator@npm:^13.6.0": version: 13.6.0 resolution: "validator@npm:13.6.0" |