diff options
28 files changed, 109 insertions, 68 deletions
diff --git a/src/lib/common/ButtonPaginator.ts b/src/lib/common/ButtonPaginator.ts index 0c18119..0399e74 100644 --- a/src/lib/common/ButtonPaginator.ts +++ b/src/lib/common/ButtonPaginator.ts @@ -53,8 +53,7 @@ export class ButtonPaginator { ) { this.message = message; this.embeds = embeds; - // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing - this.text = text || null; + this.text = text ? text : null; this.deleteOnExit = deleteOnExit; this.curPage = startOn - 1; diff --git a/src/lib/extensions/discord-akairo/BushClientUtil.ts b/src/lib/extensions/discord-akairo/BushClientUtil.ts index 968a805..e3c0803 100644 --- a/src/lib/extensions/discord-akairo/BushClientUtil.ts +++ b/src/lib/extensions/discord-akairo/BushClientUtil.ts @@ -793,8 +793,9 @@ export class BushClientUtil extends ClientUtil { public clientSendAndPermCheck(message: BushMessage | BushSlashMessage, permissions: bigint[] = [], checkChannel = false) { const missing = []; const sendPerm = message.channel!.isThread() ? Permissions.FLAGS.SEND_MESSAGES : Permissions.FLAGS.SEND_MESSAGES_IN_THREADS; + if (!message.inGuild()) return null; - if (!message.guild!.me!.permissionsIn(message.channel!.id!).has(sendPerm)) missing.push(sendPerm); + if (!message.guild.me!.permissionsIn(message.channel.id).has(sendPerm)) missing.push(sendPerm); missing.push( ...(checkChannel @@ -867,15 +868,14 @@ export class BushClientUtil extends ClientUtil { return deepLock; } - public get time(): Record<keyof typeof client.constants.timeUnits, number> { - const values = Object.entries(client.constants.timeUnits).map(([key, value]) => [key, value.value]); - return Object.fromEntries(values); - } - + /** + * The link to invite the bot with all permissions. + */ public get invite() { - return `https://discord.com/api/oauth2/authorize?client_id=${client.user!.id}&permissions=${ - Permissions.ALL - }&scope=bot%20applications.commands`; + return `https://discord.com/api/oauth2/authorize?client_id=${Buffer.from( + client.token!.split('.')[0], + 'base64' + ).toString()}&permissions=${Permissions.ALL}&scope=bot%20applications.commands`; } /** diff --git a/src/lib/extensions/discord.js/BushGuild.ts b/src/lib/extensions/discord.js/BushGuild.ts index bbef953..b546dab 100644 --- a/src/lib/extensions/discord.js/BushGuild.ts +++ b/src/lib/extensions/discord.js/BushGuild.ts @@ -370,7 +370,7 @@ export class BushGuild extends Guild { author: { name: moderator.user.tag, icon_url: moderator.displayAvatarURL() }, title: `This channel has been ${options.unlock ? 'un' : ''}locked`, description: options.reason ?? 'No reason provided', - color: options.unlock ? util.colors.discord.GREEN : util.colors.discord.RED, + color: options.unlock ? util.colors.GREEN : util.colors.RED, timestamp: new Date().toISOString() } ] diff --git a/src/lib/utils/BushConstants.ts b/src/lib/utils/BushConstants.ts index 4e73672..e7b69ae 100644 --- a/src/lib/utils/BushConstants.ts +++ b/src/lib/utils/BushConstants.ts @@ -2,8 +2,51 @@ import { Constants } from 'discord.js'; import { BushClientUtil } from '../extensions/discord-akairo/BushClientUtil.js'; const rawCapeUrl = 'https://raw.githubusercontent.com/NotEnoughUpdates/capes/master/'; + +export const enum Time { + /** + * One millisecond (1 ms). + */ + Millisecond = 1, + + /** + * One second (1,000 ms). + */ + Second = Millisecond * 1000, + + /** + * One minute (60,000 ms). + */ + Minute = Second * 60, + + /** + * One hour (3,600,000 ms). + */ + Hour = Minute * 60, + + /** + * One day (86,400,000 ms). + */ + Day = Hour * 24, + + /** + * One week (604,800,000 ms). + */ + Week = Day * 7, + + /** + * One month (2,629,800,000 ms). + */ + Month = Day * 30.4375, // average of days in a month (including leap years) + + /** + * One year (31,557,600,000 ms). + */ + Year = Day * 365.25 // average with leap years +} + export class BushConstants { - public static emojis = BushClientUtil.deepFreeze({ + public static emojis = Object.freeze({ success: '<:success:837109864101707807>', warn: '<:warn:848726900876247050>', error: '<:error:837123021016924261>', @@ -22,7 +65,7 @@ export class BushConstants { check: '<:check:878320135297961995>' } as const); - public static colors = BushClientUtil.deepFreeze({ + public static colors = Object.freeze({ default: 0x1fd8f1, error: 0xef4947, warn: 0xfeba12, @@ -45,42 +88,42 @@ export class BushConstants { darkGray: 0x7a7a7a, black: 0x000000, orange: 0xe86100, - discord: Object.assign({}, Constants.Colors) + ...Constants.Colors } as const); // Somewhat stolen from @Mzato0001 public static timeUnits = BushClientUtil.deepFreeze({ milliseconds: { match: / (?:(?<milliseconds>-?(?:\d+)?\.?\d+) *(?:milliseconds?|msecs?|ms))/im, - value: 1 + value: Time.Millisecond }, seconds: { match: / (?:(?<seconds>-?(?:\d+)?\.?\d+) *(?:seconds?|secs?|s))/im, - value: 1000 + value: Time.Second }, minutes: { - match: / (?:(?<minutes>-?(?:\d+)?\.?\d+) *(?:minutes?|mins?))/im, - value: 1000 * 60 + match: / (?:(?<minutes>-?(?:\d+)?\.?\d+) *(?:minutes?|mins?|m))/im, + value: Time.Minute }, hours: { match: / (?:(?<hours>-?(?:\d+)?\.?\d+) *(?:hours?|hrs?|h))/im, - value: 1000 * 60 * 60 + value: Time.Hour }, days: { match: / (?:(?<days>-?(?:\d+)?\.?\d+) *(?:days?|d))/im, - value: 1000 * 60 * 60 * 24 + value: Time.Day }, weeks: { match: / (?:(?<weeks>-?(?:\d+)?\.?\d+) *(?:weeks?|w))/im, - value: 1000 * 60 * 60 * 24 * 7 + value: Time.Week }, months: { - match: / (?:(?<months>-?(?:\d+)?\.?\d+) *(?:months?|mon|mo?))/im, - value: 1000 * 60 * 60 * 24 * 30.4375 // average of days in months including leap years + match: / (?:(?<months>-?(?:\d+)?\.?\d+) *(?:months?|mon|mo))/im, + value: Time.Month }, years: { match: / (?:(?<years>-?(?:\d+)?\.?\d+) *(?:years?|y))/im, - value: 1000 * 60 * 60 * 24 * 365.25 //leap years + value: Time.Year } } as const); @@ -93,7 +136,7 @@ export class BushConstants { /(?:ptb\.|canary\.|staging\.|lc\.)?(?:discord(?:app)?|inv)\.(?:com|wtf)?\/channels\/(?<guild_id>\d{15,21}|@me)\/(?<channel_id>\d{15,21})\/(?<message_id>\d{15,21})/im } as const); - public static pronounMapping = BushClientUtil.deepFreeze({ + public static pronounMapping = Object.freeze({ unspecified: 'Unspecified', hh: 'He/Him', hi: 'He/It', @@ -318,6 +361,7 @@ export class BushConstants { { name: 'secondpfirsisch' }, { name: 'stormy_lh' } ].map((value, index) => ({ ...value, index })), + roleMap: [ { name: '*', id: '792453550768390194' }, { name: 'Admin Perms', id: '746541309853958186' }, @@ -343,9 +387,9 @@ export class BushConstants { { name: 'No Bots', id: '786804858765312030' }, { name: 'No VC', id: '788850482554208267' }, { name: 'No Giveaways', id: '808265422334984203' }, - { name: 'No Support', id: '790247359824396319' }, - { name: 'DJ', id: '782619038403919902' } + { name: 'No Support', id: '790247359824396319' } ], + roleWhitelist: { 'Partner': ['*', 'Admin Perms', 'Sr. Moderator', 'Moderator'], 'Suggester': ['*', 'Admin Perms', 'Sr. Moderator', 'Moderator', 'Helper', 'Trial Helper', 'Contributor'], @@ -368,7 +412,7 @@ export class BushConstants { } } as const); - public static ArgumentMatches = BushClientUtil.deepFreeze({ + public static ArgumentMatches = Object.freeze({ PHRASE: 'phrase', FLAG: 'flag', OPTION: 'option', @@ -380,7 +424,7 @@ export class BushConstants { NONE: 'none' } as const); - public static ArgumentTypes = BushClientUtil.deepFreeze({ + public static ArgumentTypes = Object.freeze({ STRING: 'string', LOWERCASE: 'lowercase', UPPERCASE: 'uppercase', @@ -445,7 +489,7 @@ export class BushConstants { GLOBAL_USER: 'globalUser' } as const); - public static BlockedReasons = BushClientUtil.deepFreeze({ + public static BlockedReasons = Object.freeze({ CLIENT: 'client', BOT: 'bot', OWNER: 'owner', @@ -465,7 +509,7 @@ export class BushConstants { RESTRICTED_CHANNEL: 'restrictedChannel' } as const); - public static CommandHandlerEvents = BushClientUtil.deepFreeze({ + public static CommandHandlerEvents = Object.freeze({ COMMAND_BLOCKED: 'commandBlocked', COMMAND_BREAKOUT: 'commandBreakout', COMMAND_CANCELLED: 'commandCancelled', diff --git a/src/listeners/guild-custom/bushLockdown.ts b/src/listeners/guild-custom/bushLockdown.ts index f3e72e7..6a075b4 100644 --- a/src/listeners/guild-custom/bushLockdown.ts +++ b/src/listeners/guild-custom/bushLockdown.ts @@ -15,12 +15,11 @@ export default class BushLockdownListener extends BushListener { if (!logChannel) return; const logEmbed = new Embed() - .setColor(util.colors.discord.BLURPLE) + .setColor(util.colors.BLURPLE) .setTimestamp() .addField({ name: '**Action**', value: `${'Lockdown'}` }) .addField({ name: '**Moderator**', value: `${moderator} (${moderator.user.tag})` }) - // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing - .addField({ name: '**Reason**', value: `${reason || '[No Reason Provided]'}` }) + .addField({ name: '**Reason**', value: `${reason ? reason : '[No Reason Provided]'}` }) .addField({ name: `**Channel${channelsSuccessMap.size > 1 ? 's' : ''}**`, value: channelsSuccessMap diff --git a/src/listeners/guild-custom/bushUnlockdown.ts b/src/listeners/guild-custom/bushUnlockdown.ts index 0ac2a13..6c87678 100644 --- a/src/listeners/guild-custom/bushUnlockdown.ts +++ b/src/listeners/guild-custom/bushUnlockdown.ts @@ -15,12 +15,11 @@ export default class BushUnlockdownListener extends BushListener { if (!logChannel) return; const logEmbed = new Embed() - .setColor(util.colors.discord.BLURPLE) + .setColor(util.colors.BLURPLE) .setTimestamp() .addField({ name: '**Action**', value: `${'Unlockdown'}` }) .addField({ name: '**Moderator**', value: `${moderator} (${moderator.user.tag})` }) - // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing - .addField({ name: '**Reason**', value: `${reason || '[No Reason Provided]'}` }) + .addField({ name: '**Reason**', value: `${reason ? reason : '[No Reason Provided]'}` }) .addField({ name: `**Channel${channelsSuccessMap.size > 1 ? 's' : ''}**`, value: channelsSuccessMap diff --git a/src/listeners/guild/guildCreate.ts b/src/listeners/guild/guildCreate.ts index 2df3268..0e2540f 100644 --- a/src/listeners/guild/guildCreate.ts +++ b/src/listeners/guild/guildCreate.ts @@ -19,7 +19,7 @@ export default class GuildCreateListener extends BushListener { return await channel.send({ embeds: [ { - color: util.colors.discord.GREEN, + color: util.colors.GREEN, description: `${util.emojis.join} Joined ${util.format.input( guild.name )} with **${guild.memberCount?.toLocaleString()}** members. I am now in **${client.guilds.cache.size}** guilds.`, diff --git a/src/listeners/guild/guildDelete.ts b/src/listeners/guild/guildDelete.ts index 8284c02..2af2295 100644 --- a/src/listeners/guild/guildDelete.ts +++ b/src/listeners/guild/guildDelete.ts @@ -17,7 +17,7 @@ export default class GuildDeleteListener extends BushListener { return await channel.send({ embeds: [ { - color: util.colors.discord.RED, + color: util.colors.RED, description: `${util.emojis.leave} Left ${util.format.input( guild.name )} with **${guild.memberCount?.toLocaleString()}** members. I am now in **${client.guilds.cache.size}** guilds.`, diff --git a/src/listeners/member-custom/bushBan.ts b/src/listeners/member-custom/bushBan.ts index 90b7c27..77ebaaf 100644 --- a/src/listeners/member-custom/bushBan.ts +++ b/src/listeners/member-custom/bushBan.ts @@ -16,7 +16,7 @@ export default class BushBanListener extends BushListener { const user = victim instanceof GuildMember ? victim.user : victim; const logEmbed = new Embed() - .setColor(util.colors.discord.RED) + .setColor(util.colors.RED) .setTimestamp() .setFooter({ text: `CaseID: ${caseID}` }) .setAuthor({ name: user.tag, iconURL: user.avatarURL({ format: 'png', size: 4096 }) ?? undefined }) diff --git a/src/listeners/member-custom/bushBlock.ts b/src/listeners/member-custom/bushBlock.ts index d29261b..d4f7c98 100644 --- a/src/listeners/member-custom/bushBlock.ts +++ b/src/listeners/member-custom/bushBlock.ts @@ -18,7 +18,7 @@ export default class BushBlockListener extends BushListener { const user = victim instanceof GuildMember ? victim.user : victim; const logEmbed = new Embed() - .setColor(util.colors.discord.PURPLE) + .setColor(util.colors.PURPLE) .setTimestamp() .setFooter({ text: `CaseID: ${caseID}` }) .setAuthor({ name: user.tag, iconURL: user.avatarURL({ format: 'png', size: 4096 }) ?? undefined }) diff --git a/src/listeners/member-custom/bushKick.ts b/src/listeners/member-custom/bushKick.ts index 9d309ac..822201d 100644 --- a/src/listeners/member-custom/bushKick.ts +++ b/src/listeners/member-custom/bushKick.ts @@ -16,7 +16,7 @@ export default class BushKickListener extends BushListener { const user = victim instanceof GuildMember ? victim.user : victim; const logEmbed = new Embed() - .setColor(util.colors.discord.RED) + .setColor(util.colors.RED) .setTimestamp() .setFooter({ text: `CaseID: ${caseID}` }) .setAuthor({ name: user.tag, iconURL: user.avatarURL({ format: 'png', size: 4096 }) ?? undefined }) diff --git a/src/listeners/member-custom/bushMute.ts b/src/listeners/member-custom/bushMute.ts index 25146a2..c6361b0 100644 --- a/src/listeners/member-custom/bushMute.ts +++ b/src/listeners/member-custom/bushMute.ts @@ -16,7 +16,7 @@ export default class BushMuteListener extends BushListener { const user = victim instanceof GuildMember ? victim.user : victim; const logEmbed = new Embed() - .setColor(util.colors.discord.ORANGE) + .setColor(util.colors.ORANGE) .setTimestamp() .setFooter({ text: `CaseID: ${caseID}` }) .setAuthor({ name: user.tag, iconURL: user.avatarURL({ format: 'png', size: 4096 }) ?? undefined }) diff --git a/src/listeners/member-custom/bushPunishRole.ts b/src/listeners/member-custom/bushPunishRole.ts index cbcc925..7e87b65 100644 --- a/src/listeners/member-custom/bushPunishRole.ts +++ b/src/listeners/member-custom/bushPunishRole.ts @@ -16,7 +16,7 @@ export default class BushPunishRoleListener extends BushListener { const user = victim instanceof GuildMember ? victim.user : victim; const logEmbed = new Embed() - .setColor(util.colors.discord.YELLOW) + .setColor(util.colors.YELLOW) .setTimestamp() .setFooter({ text: `CaseID: ${caseID}` }) .setAuthor({ name: user.tag, iconURL: user.avatarURL({ format: 'png', size: 4096 }) ?? undefined }) diff --git a/src/listeners/member-custom/bushPunishRoleRemove.ts b/src/listeners/member-custom/bushPunishRoleRemove.ts index c68e8d5..e9d3d95 100644 --- a/src/listeners/member-custom/bushPunishRoleRemove.ts +++ b/src/listeners/member-custom/bushPunishRoleRemove.ts @@ -16,7 +16,7 @@ export default class BushPunishRoleRemoveListener extends BushListener { const user = victim instanceof GuildMember ? victim.user : victim; const logEmbed = new Embed() - .setColor(util.colors.discord.GREEN) + .setColor(util.colors.GREEN) .setTimestamp() .setFooter({ text: `CaseID: ${caseID}` }) .setAuthor({ name: user.tag, iconURL: user.avatarURL({ format: 'png', size: 4096 }) ?? undefined }) diff --git a/src/listeners/member-custom/bushPurge.ts b/src/listeners/member-custom/bushPurge.ts index e3a43af..5c685cd 100644 --- a/src/listeners/member-custom/bushPurge.ts +++ b/src/listeners/member-custom/bushPurge.ts @@ -24,7 +24,7 @@ export default class BushPurgeListener extends BushListener { const haste = await util.inspectCleanRedactHaste(mappedMessages); const logEmbed = new Embed() - .setColor(util.colors.discord.DARK_PURPLE) + .setColor(util.colors.DARK_PURPLE) .setTimestamp() .setFooter({ text: `${messages.size.toLocaleString()} Messages` }) .setAuthor({ name: moderator.tag, iconURL: moderator.avatarURL({ format: 'png', size: 4096 }) ?? undefined }) diff --git a/src/listeners/member-custom/bushRemoveTimeout.ts b/src/listeners/member-custom/bushRemoveTimeout.ts index 820a3b7..947bec9 100644 --- a/src/listeners/member-custom/bushRemoveTimeout.ts +++ b/src/listeners/member-custom/bushRemoveTimeout.ts @@ -16,7 +16,7 @@ export default class BushRemoveTimeoutListener extends BushListener { const user = victim instanceof GuildMember ? victim.user : victim; const logEmbed = new Embed() - .setColor(util.colors.discord.GREEN) + .setColor(util.colors.GREEN) .setTimestamp() .setFooter({ text: `CaseID: ${caseID}` }) .setAuthor({ name: user.tag, iconURL: user.avatarURL({ format: 'png', size: 4096 }) ?? undefined }) diff --git a/src/listeners/member-custom/bushTimeout.ts b/src/listeners/member-custom/bushTimeout.ts index 79fd739..8acc506 100644 --- a/src/listeners/member-custom/bushTimeout.ts +++ b/src/listeners/member-custom/bushTimeout.ts @@ -18,7 +18,7 @@ export default class BushTimeoutListener extends BushListener { const user = victim instanceof GuildMember ? victim.user : victim; const logEmbed = new Embed() - .setColor(util.colors.discord.ORANGE) + .setColor(util.colors.ORANGE) .setTimestamp() .setFooter({ text: `CaseID: ${caseID}` }) .setAuthor({ name: user.tag, iconURL: user.avatarURL({ format: 'png', size: 4096 }) ?? undefined }) diff --git a/src/listeners/member-custom/bushUnban.ts b/src/listeners/member-custom/bushUnban.ts index b7f6346..d58ae21 100644 --- a/src/listeners/member-custom/bushUnban.ts +++ b/src/listeners/member-custom/bushUnban.ts @@ -16,7 +16,7 @@ export default class BushUnbanListener extends BushListener { const user = victim instanceof GuildMember ? victim.user : victim; const logEmbed = new Embed() - .setColor(util.colors.discord.GREEN) + .setColor(util.colors.GREEN) .setTimestamp() .setFooter({ text: `CaseID: ${caseID}` }) .setAuthor({ name: user.tag, iconURL: user.avatarURL({ format: 'png', size: 4096 }) ?? undefined }) diff --git a/src/listeners/member-custom/bushUnblock.ts b/src/listeners/member-custom/bushUnblock.ts index 580a424..ead2a7d 100644 --- a/src/listeners/member-custom/bushUnblock.ts +++ b/src/listeners/member-custom/bushUnblock.ts @@ -16,7 +16,7 @@ export default class BushUnblockListener extends BushListener { const user = victim instanceof GuildMember ? victim.user : victim; const logEmbed = new Embed() - .setColor(util.colors.discord.GREEN) + .setColor(util.colors.GREEN) .setTimestamp() .setFooter({ text: `CaseID: ${caseID}` }) .setAuthor({ name: user.tag, iconURL: user.avatarURL({ format: 'png', size: 4096 }) ?? undefined }) diff --git a/src/listeners/member-custom/bushUnmute.ts b/src/listeners/member-custom/bushUnmute.ts index 19c9a74..b88f450 100644 --- a/src/listeners/member-custom/bushUnmute.ts +++ b/src/listeners/member-custom/bushUnmute.ts @@ -16,7 +16,7 @@ export default class BushUnmuteListener extends BushListener { const user = victim instanceof GuildMember ? victim.user : victim; const logEmbed = new Embed() - .setColor(util.colors.discord.GREEN) + .setColor(util.colors.GREEN) .setTimestamp() .setFooter({ text: `CaseID: ${caseID}` }) .setAuthor({ name: user.tag, iconURL: user.avatarURL({ format: 'png', size: 4096 }) ?? undefined }) diff --git a/src/listeners/member-custom/bushUpdateModlog.ts b/src/listeners/member-custom/bushUpdateModlog.ts index 86782f6..199e32e 100644 --- a/src/listeners/member-custom/bushUpdateModlog.ts +++ b/src/listeners/member-custom/bushUpdateModlog.ts @@ -15,7 +15,7 @@ export default class BushUpdateModlogListener extends BushListener { if (!logChannel) return; const logEmbed = new Embed() - .setColor(util.colors.discord.BLURPLE) + .setColor(util.colors.BLURPLE) .setTimestamp() .setAuthor({ name: moderator.user.tag, diff --git a/src/listeners/member-custom/bushUpdateSettings.ts b/src/listeners/member-custom/bushUpdateSettings.ts index 518f7b6..61fdfaa 100644 --- a/src/listeners/member-custom/bushUpdateSettings.ts +++ b/src/listeners/member-custom/bushUpdateSettings.ts @@ -14,7 +14,7 @@ export default class BushUpdateSettingsListener extends BushListener { const logChannel = await guild.getLogChannel('moderation'); if (!logChannel) return; - const logEmbed = new Embed().setColor(util.colors.discord.BLURPLE).setTimestamp(); + const logEmbed = new Embed().setColor(util.colors.BLURPLE).setTimestamp(); if (moderator) logEmbed.setAuthor({ diff --git a/src/listeners/member-custom/bushWarn.ts b/src/listeners/member-custom/bushWarn.ts index a4e71a8..11eeb49 100644 --- a/src/listeners/member-custom/bushWarn.ts +++ b/src/listeners/member-custom/bushWarn.ts @@ -16,7 +16,7 @@ export default class BushWarnListener extends BushListener { const user = victim instanceof GuildMember ? victim.user : victim; const logEmbed = new Embed() - .setColor(util.colors.discord.YELLOW) + .setColor(util.colors.YELLOW) .setTimestamp() .setFooter({ text: `CaseID: ${caseID}` }) .setAuthor({ name: user.tag, iconURL: user.avatarURL({ format: 'png', size: 4096 }) ?? undefined }) diff --git a/src/listeners/message/autoThread.ts b/src/listeners/message/autoThread.ts index b753dc3..45cd337 100644 --- a/src/listeners/message/autoThread.ts +++ b/src/listeners/message/autoThread.ts @@ -50,7 +50,7 @@ export default class autoThreadListener extends BushListener { .setDescription( `Welcome to Moulberry Bush Support:tm:\n\nPlease make sure you have the latest version found in <#693586404256645231>.\nAdditionally if you need help installing the mod be sure to read <#737444942724726915> for a guide on how to do so.` ) - .setColor(client.consts.colors.discord.BLURPLE); + .setColor(client.consts.colors.BLURPLE); void thread .send({ embeds: [embed] }) .then(() => diff --git a/src/listeners/track-manual-punishments/modlogSyncBan.ts b/src/listeners/track-manual-punishments/modlogSyncBan.ts index 7625357..b908231 100644 --- a/src/listeners/track-manual-punishments/modlogSyncBan.ts +++ b/src/listeners/track-manual-punishments/modlogSyncBan.ts @@ -1,4 +1,4 @@ -import { BushListener, BushUser, Moderation, ModLogType, type BushClientEvents } from '#lib'; +import { BushListener, BushUser, Moderation, ModLogType, Time, type BushClientEvents } from '#lib'; import { AuditLogEvent } from 'discord-api-types'; import { Embed, Permissions } from 'discord.js'; @@ -34,7 +34,7 @@ export default class ModlogSyncBanListener extends BushListener { if (!first.executor || first.executor?.bot) return; - if (Math.abs(first.createdAt.getTime() - now.getTime()) > util.time.minutes) { + if (Math.abs(first.createdAt.getTime() - now.getTime()) > Time.Minute) { console.log(util.humanizeDuration(Math.abs(first.createdAt.getTime() - now.getTime()))); throw new Error('Time is off by over a minute'); } @@ -52,7 +52,7 @@ export default class ModlogSyncBanListener extends BushListener { if (!logChannel) return; const logEmbed = new Embed() - .setColor(util.colors.discord.RED) + .setColor(util.colors.RED) .setTimestamp() .setFooter({ text: `CaseID: ${log.id}` }) .setAuthor({ diff --git a/src/listeners/track-manual-punishments/modlogSyncKick.ts b/src/listeners/track-manual-punishments/modlogSyncKick.ts index a369618..6bf661c 100644 --- a/src/listeners/track-manual-punishments/modlogSyncKick.ts +++ b/src/listeners/track-manual-punishments/modlogSyncKick.ts @@ -1,4 +1,4 @@ -import { BushListener, BushUser, Moderation, ModLogType, type BushClientEvents } from '#lib'; +import { BushListener, BushUser, Moderation, ModLogType, Time, type BushClientEvents } from '#lib'; import { AuditLogEvent } from 'discord-api-types'; import { Embed, Permissions } from 'discord.js'; @@ -34,7 +34,7 @@ export default class ModlogSyncKickListener extends BushListener { if (!first.executor || first.executor?.bot) return; - if (Math.abs(first.createdAt.getTime() - now.getTime()) > util.time.minutes) { + if (Math.abs(first.createdAt.getTime() - now.getTime()) > Time.Minute) { console.log(util.humanizeDuration(Math.abs(first.createdAt.getTime() - now.getTime()))); throw new Error('Time is off by over a minute'); } @@ -52,7 +52,7 @@ export default class ModlogSyncKickListener extends BushListener { if (!logChannel) return; const logEmbed = new Embed() - .setColor(util.colors.discord.RED) + .setColor(util.colors.RED) .setTimestamp() .setFooter({ text: `CaseID: ${log.id}` }) .setAuthor({ diff --git a/src/listeners/track-manual-punishments/modlogSyncTimeout.ts b/src/listeners/track-manual-punishments/modlogSyncTimeout.ts index dd9391a..fb48faa 100644 --- a/src/listeners/track-manual-punishments/modlogSyncTimeout.ts +++ b/src/listeners/track-manual-punishments/modlogSyncTimeout.ts @@ -1,4 +1,4 @@ -import { BushListener, BushUser, Moderation, ModLogType, type BushClientEvents } from '#lib'; +import { BushListener, BushUser, Moderation, ModLogType, Time, type BushClientEvents } from '#lib'; import { AuditLogEvent } from 'discord-api-types'; import { Embed, Permissions } from 'discord.js'; @@ -36,7 +36,7 @@ export default class ModlogSyncTimeoutListener extends BushListener { const timeOut = first.changes?.find((changes) => changes.key === 'communication_disabled_until'); if (!timeOut) return; - if (Math.abs(first.createdAt.getTime() - now.getTime()) > util.time.minutes) { + if (Math.abs(first.createdAt.getTime() - now.getTime()) > Time.Minute) { console.log(util.humanizeDuration(Math.abs(first.createdAt.getTime() - now.getTime()))); throw new Error('Time is off by over a minute'); } @@ -57,7 +57,7 @@ export default class ModlogSyncTimeoutListener extends BushListener { if (!logChannel) return; const logEmbed = new Embed() - .setColor(util.colors.discord[newTime ? 'ORANGE' : 'GREEN']) + .setColor(util.colors[newTime ? 'ORANGE' : 'GREEN']) .setTimestamp() .setFooter({ text: `CaseID: ${log.id}` }) .setAuthor({ diff --git a/src/listeners/track-manual-punishments/modlogSyncUnban.ts b/src/listeners/track-manual-punishments/modlogSyncUnban.ts index 84887e3..e297fce 100644 --- a/src/listeners/track-manual-punishments/modlogSyncUnban.ts +++ b/src/listeners/track-manual-punishments/modlogSyncUnban.ts @@ -1,4 +1,4 @@ -import { BushListener, BushUser, Moderation, ModLogType, type BushClientEvents } from '#lib'; +import { BushListener, BushUser, Moderation, ModLogType, Time, type BushClientEvents } from '#lib'; import { AuditLogEvent } from 'discord-api-types'; import { Embed, Permissions } from 'discord.js'; @@ -33,7 +33,7 @@ export default class ModlogSyncUnbanListener extends BushListener { if (!first.executor || first.executor?.bot) return; - if (Math.abs(first.createdAt.getTime() - now.getTime()) > util.time.minutes) { + if (Math.abs(first.createdAt.getTime() - now.getTime()) > Time.Minute) { console.log(util.humanizeDuration(Math.abs(first.createdAt.getTime() - now.getTime()))); throw new Error('Time is off by over a minute'); } @@ -51,7 +51,7 @@ export default class ModlogSyncUnbanListener extends BushListener { if (!logChannel) return; const logEmbed = new Embed() - .setColor(util.colors.discord.ORANGE) + .setColor(util.colors.ORANGE) .setTimestamp() .setFooter({ text: `CaseID: ${log.id}` }) .setAuthor({ |