diff options
author | IRONM00N <64110067+IRONM00N@users.noreply.github.com> | 2021-07-08 22:19:24 -0400 |
---|---|---|
committer | IRONM00N <64110067+IRONM00N@users.noreply.github.com> | 2021-07-08 22:19:24 -0400 |
commit | 820f55fc9bc8a4540666c03a414d68bcfbead4fc (patch) | |
tree | c6f42825fd5e13ee0d78c07a4533ea83c0f150f9 /src | |
parent | 86be44fc0485085a77b7945a22f579e6b3a5b510 (diff) | |
download | tanzanite-820f55fc9bc8a4540666c03a414d68bcfbead4fc.tar.gz tanzanite-820f55fc9bc8a4540666c03a414d68bcfbead4fc.tar.bz2 tanzanite-820f55fc9bc8a4540666c03a414d68bcfbead4fc.zip |
fix breaking changes
Diffstat (limited to 'src')
-rw-r--r-- | src/commands/moulberry-bush/rule.ts | 8 | ||||
-rw-r--r-- | src/lib/extensions/discord-akairo/BushClient.ts | 8 | ||||
-rw-r--r-- | src/lib/extensions/discord-akairo/BushClientUtil.ts | 30 | ||||
-rw-r--r-- | src/lib/extensions/discord-akairo/BushTask.ts | 5 | ||||
-rw-r--r-- | src/lib/extensions/discord.js/BushApplicationCommandManager.ts | 7 | ||||
-rw-r--r-- | src/lib/extensions/discord.js/BushApplicationCommandPermissionsManager.ts | 11 | ||||
-rw-r--r-- | src/lib/extensions/discord.js/BushGuildMember.ts | 2 | ||||
-rw-r--r-- | src/lib/extensions/discord.js/BushMessage.ts | 4 | ||||
-rw-r--r-- | src/lib/extensions/discord.js/BushNewsChannel.ts | 4 | ||||
-rw-r--r-- | src/lib/extensions/discord.js/BushThreadManager.ts | 2 | ||||
-rw-r--r-- | src/lib/extensions/discord.js/BushThreadMemberManager.ts | 4 | ||||
-rw-r--r-- | src/listeners/client/interaction.ts | 4 | ||||
-rw-r--r-- | src/listeners/commands/commandError.ts | 6 | ||||
-rw-r--r-- | src/listeners/commands/commandStarted.ts | 2 |
14 files changed, 53 insertions, 44 deletions
diff --git a/src/commands/moulberry-bush/rule.ts b/src/commands/moulberry-bush/rule.ts index f8d312f..f2e0911 100644 --- a/src/commands/moulberry-bush/rule.ts +++ b/src/commands/moulberry-bush/rule.ts @@ -134,18 +134,18 @@ export default class RuleCommand extends BushCommand { async function respond(): Promise<unknown> { if (!user) { // If the original message was a reply -> imitate it - (message as BushMessage).reference?.messageID && !message.util.isSlash - ? await message.channel.messages.fetch((message as BushMessage).reference.messageID).then(async (message) => { + (message as BushMessage).reference?.messageId && !message.util.isSlash + ? await message.channel.messages.fetch((message as BushMessage).reference.messageId).then(async (message) => { await message.util.reply({ embeds: [rulesEmbed], allowedMentions: AllowedMentions.users() }); }) : await message.util.send({ embeds: [rulesEmbed], allowedMentions: AllowedMentions.users() }); } else { - return (message as BushMessage).reference?.messageID && !message.util.isSlash + return (message as BushMessage).reference?.messageId && !message.util.isSlash ? await message.util.send({ content: `<@!${user.id}>`, embeds: [rulesEmbed], allowedMentions: AllowedMentions.users(), - reply: { messageReference: (message as BushMessage).reference.messageID } + reply: { messageReference: (message as BushMessage).reference.messageId } }) : await message.util.send({ content: `<@!${user.id}>`, diff --git a/src/lib/extensions/discord-akairo/BushClient.ts b/src/lib/extensions/discord-akairo/BushClient.ts index 4f33fa4..99fd772 100644 --- a/src/lib/extensions/discord-akairo/BushClient.ts +++ b/src/lib/extensions/discord-akairo/BushClient.ts @@ -106,11 +106,11 @@ export class BushClient extends AkairoClient { super( { ownerID: config.owners, - intents: Intents.ALL + intents: Object.values(Intents.FLAGS).reduce((acc, p) => acc | p, 0) }, { allowedMentions: AllowedMentions.users(), // No everyone or role mentions by default - intents: Intents.ALL + intents: Object.values(Intents.FLAGS).reduce((acc, p) => acc | p, 0) } ); @@ -271,10 +271,10 @@ export class BushClient extends AkairoClient { } public isOwner(user: BushUserResolvable): boolean { - return this.config.owners.includes(this.users.resolveID(user)); + return this.config.owners.includes(this.users.resolveId(user)); } public isSuperUser(user: BushUserResolvable): boolean { - const userID = this.users.resolveID(user); + const userID = this.users.resolveId(user); return !!BushCache?.global?.superUsers?.includes(userID) || this.config.owners.includes(userID); } } diff --git a/src/lib/extensions/discord-akairo/BushClientUtil.ts b/src/lib/extensions/discord-akairo/BushClientUtil.ts index 4a38b3e..c2d9da7 100644 --- a/src/lib/extensions/discord-akairo/BushClientUtil.ts +++ b/src/lib/extensions/discord-akairo/BushClientUtil.ts @@ -312,11 +312,11 @@ export class BushClientUtil extends ClientUtil { components: [getPaginationRow()] }); const filter = (interaction: ButtonInteraction) => - interaction.customID.startsWith('paginate_') && interaction.message == msg; + interaction.customId.startsWith('paginate_') && interaction.message == msg; const collector = msg.createMessageComponentCollector({ filter, time: 300000 }); collector.on('collect', async (interaction: MessageComponentInteraction) => { if (interaction.user.id == message.author.id || this.client.config.owners.includes(interaction.user.id)) { - switch (interaction.customID) { + switch (interaction.customId) { case 'paginate_beginning': { curPage = 0; await edit(interaction); @@ -370,26 +370,26 @@ export class BushClientUtil extends ClientUtil { return new MessageActionRow().addComponents( new MessageButton({ style, - customID: 'paginate_beginning', + customId: 'paginate_beginning', emoji: paginateEmojis.beginning, disabled: disableAll || curPage == 0 }), new MessageButton({ style, - customID: 'paginate_back', + customId: 'paginate_back', emoji: paginateEmojis.back, disabled: disableAll || curPage == 0 }), - new MessageButton({ style, customID: 'paginate_stop', emoji: paginateEmojis.stop, disabled: disableAll }), + new MessageButton({ style, customId: 'paginate_stop', emoji: paginateEmojis.stop, disabled: disableAll }), new MessageButton({ style, - customID: 'paginate_next', + customId: 'paginate_next', emoji: paginateEmojis.forward, disabled: disableAll || curPage == embeds.length - 1 }), new MessageButton({ style, - customID: 'paginate_end', + customId: 'paginate_end', emoji: paginateEmojis.end, disabled: disableAll || curPage == embeds.length - 1 }) @@ -401,7 +401,7 @@ export class BushClientUtil extends ClientUtil { public async sendWithDeleteButton(message: BushMessage | BushSlashMessage, options: MessageOptions): Promise<void> { updateOptions(); const msg = await message.util.reply(options as MessageOptions & { split?: false }); - const filter = (interaction: ButtonInteraction) => interaction.customID == 'paginate__stop' && interaction.message == msg; + const filter = (interaction: ButtonInteraction) => interaction.customId == 'paginate__stop' && interaction.message == msg; const collector = msg.createMessageComponentCollector({ filter, time: 300000 }); collector.on('collect', async (interaction: MessageComponentInteraction) => { if (interaction.user.id == message.author.id || this.client.config.owners.includes(interaction.user.id)) { @@ -428,7 +428,7 @@ export class BushClientUtil extends ClientUtil { new MessageActionRow().addComponents( new MessageButton({ style: Constants.MessageButtonStyles.PRIMARY, - customID: 'paginate__stop', + customId: 'paginate__stop', emoji: paginateEmojis.stop, disabled: disable }) @@ -578,7 +578,7 @@ export class BushClientUtil extends ClientUtil { if (moderator.guild.id !== victim.guild.id) { throw 'moderator and victim not in same guild'; } - const isOwner = moderator.guild.ownerID === moderator.id; + const isOwner = moderator.guild.ownerId === moderator.id; if (moderator.id === victim.id) { return `${this.client.util.emojis.error} You cannot ${type} yourself.`; } @@ -605,9 +605,9 @@ export class BushClientUtil extends ClientUtil { }, getCaseNumber = false ): Promise<{ log: ModLog; caseNum: number }> { - const user = this.client.users.resolveID(options.user); - const moderator = this.client.users.resolveID(options.moderator); - const guild = this.client.guilds.resolveID(options.guild); + const user = this.client.users.resolveId(options.user); + const moderator = this.client.users.resolveId(options.moderator); + const guild = this.client.guilds.resolveId(options.guild); const duration = options.duration || null; // If guild does not exist create it so the modlog can reference a guild. @@ -662,8 +662,8 @@ export class BushClientUtil extends ClientUtil { } const expires = options.duration ? new Date(new Date().getTime() + options.duration) : null; - const user = this.client.users.resolveID(options.user); - const guild = this.client.guilds.resolveID(options.guild); + const user = this.client.users.resolveId(options.user); + const guild = this.client.guilds.resolveId(options.guild); const entry = dbModel.build({ user, guild, expires, modlog: options.modlog }); return await entry.save().catch((e) => { diff --git a/src/lib/extensions/discord-akairo/BushTask.ts b/src/lib/extensions/discord-akairo/BushTask.ts index 6471130..498a837 100644 --- a/src/lib/extensions/discord-akairo/BushTask.ts +++ b/src/lib/extensions/discord-akairo/BushTask.ts @@ -1,6 +1,9 @@ -import { Task } from 'discord-akairo'; +import { Task, TaskOptions } from 'discord-akairo'; import { BushClient } from '..'; export class BushTask extends Task { + public constructor(id: string, options?: TaskOptions) { + super(id, options); + } public declare client: BushClient; } diff --git a/src/lib/extensions/discord.js/BushApplicationCommandManager.ts b/src/lib/extensions/discord.js/BushApplicationCommandManager.ts index 71345c5..74def59 100644 --- a/src/lib/extensions/discord.js/BushApplicationCommandManager.ts +++ b/src/lib/extensions/discord.js/BushApplicationCommandManager.ts @@ -1,6 +1,6 @@ /* eslint-disable @typescript-eslint/no-explicit-any */ -import { ApplicationCommandManager, ApplicationCommandPermissionsManager, GuildResolvable, Snowflake } from 'discord.js'; -import { BushApplicationCommand, BushClient, BushGuildResolvable } from '..'; +import { ApplicationCommandManager, GuildResolvable, Snowflake } from 'discord.js'; +import { BushApplicationCommand, BushApplicationCommandPermissionsManager, BushClient, BushGuildResolvable } from '..'; export type BushApplicationCommandResolvable = BushApplicationCommand | Snowflake; @@ -9,9 +9,10 @@ export class BushApplicationCommandManager< PermissionsOptionsExtras = { guild: GuildResolvable }, PermissionsGuildType = null > extends ApplicationCommandManager<ApplicationCommandType, PermissionsOptionsExtras, PermissionsGuildType> { - public permissions: ApplicationCommandPermissionsManager< + public permissions: BushApplicationCommandPermissionsManager< { command?: BushApplicationCommandResolvable } & PermissionsOptionsExtras, { command: BushApplicationCommandResolvable } & PermissionsOptionsExtras, + PermissionsOptionsExtras, PermissionsGuildType, null >; diff --git a/src/lib/extensions/discord.js/BushApplicationCommandPermissionsManager.ts b/src/lib/extensions/discord.js/BushApplicationCommandPermissionsManager.ts index 5355ad8..29be5d9 100644 --- a/src/lib/extensions/discord.js/BushApplicationCommandPermissionsManager.ts +++ b/src/lib/extensions/discord.js/BushApplicationCommandPermissionsManager.ts @@ -9,9 +9,16 @@ import { BushApplicationCommand, BushApplicationCommandManager, BushClient, Bush export class BushApplicationCommandPermissionsManager< BaseOptions, FetchSingleOptions, + FullPermissionsOptions, GuildType, - CommandIDType -> extends ApplicationCommandPermissionsManager<BaseOptions, FetchSingleOptions, GuildType, CommandIDType> { + CommandIdType +> extends ApplicationCommandPermissionsManager< + BaseOptions, + FetchSingleOptions, + FullPermissionsOptions, + GuildType, + CommandIdType +> { public client: BushClient; public manager: BushApplicationCommandManager | BushGuildApplicationCommandManager | BushApplicationCommand; diff --git a/src/lib/extensions/discord.js/BushGuildMember.ts b/src/lib/extensions/discord.js/BushGuildMember.ts index e7f1ddf..4dcd99c 100644 --- a/src/lib/extensions/discord.js/BushGuildMember.ts +++ b/src/lib/extensions/discord.js/BushGuildMember.ts @@ -91,7 +91,7 @@ export class BushGuildMember extends GuildMember { if (!muteRole) return 'invalid mute role'; if (muteRole.position >= this.guild.me.roles.highest.position || muteRole.managed) return 'mute role not manageable'; - const moderator = this.client.users.cache.get(this.client.users.resolveID(options.moderator)); + const moderator = this.client.users.cache.get(this.client.users.resolveId(options.moderator)); //add role const muteSuccess = await this.roles diff --git a/src/lib/extensions/discord.js/BushMessage.ts b/src/lib/extensions/discord.js/BushMessage.ts index 9e440aa..3694356 100644 --- a/src/lib/extensions/discord.js/BushMessage.ts +++ b/src/lib/extensions/discord.js/BushMessage.ts @@ -13,8 +13,8 @@ import { export class BushMessage extends Message { public declare readonly client: BushClient; // public util: BushCommandUtil; - public declare readonly guild: BushGuild; - public declare readonly member: BushGuildMember; + public declare readonly guild: BushGuild | null; + public declare readonly member: BushGuildMember | null; public declare author: BushUser; public declare channel: BushTextChannel | BushDMChannel | BushNewsChannel | BushThreadChannel; public constructor( diff --git a/src/lib/extensions/discord.js/BushNewsChannel.ts b/src/lib/extensions/discord.js/BushNewsChannel.ts index 0ceff70..1b23abf 100644 --- a/src/lib/extensions/discord.js/BushNewsChannel.ts +++ b/src/lib/extensions/discord.js/BushNewsChannel.ts @@ -1,11 +1,11 @@ -import { NewsChannel } from 'discord.js'; +import { AllowedThreadTypeForNewsChannel, NewsChannel } from 'discord.js'; import { BushClient, BushGuild, BushMessageManager, BushThreadManager } from '..'; export class BushNewsChannel extends NewsChannel { public declare readonly client: BushClient; public declare guild: BushGuild; public declare messages: BushMessageManager; - public declare threads: BushThreadManager; + public declare threads: BushThreadManager<AllowedThreadTypeForNewsChannel>; // eslint-disable-next-line @typescript-eslint/ban-types public constructor(guild: BushGuild, data?: object) { super(guild, data); diff --git a/src/lib/extensions/discord.js/BushThreadManager.ts b/src/lib/extensions/discord.js/BushThreadManager.ts index 61ba269..15a1c8e 100644 --- a/src/lib/extensions/discord.js/BushThreadManager.ts +++ b/src/lib/extensions/discord.js/BushThreadManager.ts @@ -2,7 +2,7 @@ import { ThreadManager } from 'discord.js'; import { BushNewsChannel, BushTextChannel } from '..'; -export class BushThreadManager extends ThreadManager { +export class BushThreadManager<AllowedThreadType> extends ThreadManager<AllowedThreadType> { public declare channel: BushTextChannel | BushNewsChannel; public constructor(channel: BushTextChannel | BushNewsChannel, iterable?: Iterable<any>) { super(channel, iterable); diff --git a/src/lib/extensions/discord.js/BushThreadMemberManager.ts b/src/lib/extensions/discord.js/BushThreadMemberManager.ts index ab2cfbf..df4fc74 100644 --- a/src/lib/extensions/discord.js/BushThreadMemberManager.ts +++ b/src/lib/extensions/discord.js/BushThreadMemberManager.ts @@ -3,13 +3,11 @@ import { ThreadMemberManager } from 'discord.js'; import { BushClient, BushThreadChannel } from '..'; -export interface BushThreadMemberManager extends ThreadMemberManager {} - export class BushThreadMemberManager extends ThreadMemberManager { public declare thread: BushThreadChannel; public declare readonly client: BushClient; - public constructor(thread: BushThreadChannel, iterable?: Iterable<any>) { + public constructor(thread: BushThreadChannel, iterable?: Iterable<unknown>) { super(thread, iterable); } } diff --git a/src/listeners/client/interaction.ts b/src/listeners/client/interaction.ts index 171d5a5..d7d8776 100644 --- a/src/listeners/client/interaction.ts +++ b/src/listeners/client/interaction.ts @@ -16,12 +16,12 @@ export default class InteractionListener extends BushListener { this.client.console.info( 'SlashCommand', `The <<${interaction.commandName}>> command was used by <<${interaction.user.tag}>> in <<${ - interaction.channel.type == 'dm' ? interaction.channel.recipient + 's DMs' : interaction.channel.name + interaction.channel.type == 'DM' ? interaction.channel.recipient + 's DMs' : interaction.channel.name }>>.` ); return; } else if (interaction.isButton()) { - if (interaction.customID.startsWith('paginate_')) return; + if (interaction.customId.startsWith('paginate_')) return; return await interaction.reply({ content: 'Buttons go brrr', ephemeral: true }); } else if (interaction.isSelectMenu()) { return await interaction.reply({ diff --git a/src/listeners/commands/commandError.ts b/src/listeners/commands/commandError.ts index 0e84571..36a482d 100644 --- a/src/listeners/commands/commandError.ts +++ b/src/listeners/commands/commandError.ts @@ -39,7 +39,7 @@ export default class CommandErrorListener extends BushListener { `Oh no! While running the command \`${command.id}\`, an error occurred. Please give the developers code \`${errorNo}\`.` ); await message.util.send({ embeds: [errorUserEmbed] }).catch((e) => { - const channel = message.channel.type === 'dm' ? message.channel.recipient.tag : message.channel.name; + const channel = message.channel.type === 'DM' ? message.channel.recipient.tag : message.channel.name; this.client.console.warn('CommandError', `Failed to send user error embed in <<${channel}>>:\n` + e?.stack || e); }); } else { @@ -49,12 +49,12 @@ export default class CommandErrorListener extends BushListener { .setTimestamp() .setDescription(await this.client.util.codeblock(`${error?.stack || error}`, 2048, 'js')); await message.util.send({ embeds: [errorDevEmbed] }).catch((e) => { - const channel = message.channel.type === 'dm' ? message.channel.recipient.tag : message.channel.name; + const channel = message.channel.type === 'DM' ? message.channel.recipient.tag : message.channel.name; this.client.console.warn('CommandError', `Failed to send owner error stack in <<${channel}>>.` + e?.stack || e); }); } } - const channel = message.channel.type === 'dm' ? message.channel.recipient.tag : message.channel.name; + const channel = message.channel.type === 'DM' ? message.channel.recipient.tag : message.channel.name; this.client.console.error( 'CommandError', `an error occurred with the <<${command}>> command in <<${channel}>> triggered by <<${message?.author?.tag}>>:\n` + diff --git a/src/listeners/commands/commandStarted.ts b/src/listeners/commands/commandStarted.ts index 4f8c13c..ba1af42 100644 --- a/src/listeners/commands/commandStarted.ts +++ b/src/listeners/commands/commandStarted.ts @@ -12,7 +12,7 @@ export default class CommandStartedListener extends BushListener { this.client.logger.info( 'Command', `The <<${command.id}>> command was used by <<${message.author.tag}>> in ${ - message.channel.type === 'dm' ? `their <<DMs>>` : `<<#${message.channel.name}>> in <<${message.guild?.name}>>` + message.channel.type === 'DM' ? `their <<DMs>>` : `<<#${message.channel.name}>> in <<${message.guild?.name}>>` }.`, true //// I don't want to spam the log channel when people use commands ); |