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 | |
parent | 86be44fc0485085a77b7945a22f579e6b3a5b510 (diff) | |
download | tanzanite-820f55fc9bc8a4540666c03a414d68bcfbead4fc.tar.gz tanzanite-820f55fc9bc8a4540666c03a414d68bcfbead4fc.tar.bz2 tanzanite-820f55fc9bc8a4540666c03a414d68bcfbead4fc.zip |
fix breaking changes
25 files changed, 226 insertions, 62 deletions
@@ -48,7 +48,7 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) { ["common-tags", "npm:1.8.0"], ["discord-akairo", "https://github.com/NotEnoughUpdates/discord-akairo.git#commit=58e5a8610d9cb47257cb163a94e284113a39a62b"], ["discord-api-types", "npm:0.19.0-next.f393ba520d7d6d2aacaca7b3ca5d355fab614f6e"], - ["discord-js-structures", "https://github.com/NotEnoughUpdates/discord.js.git#commit=c71d1042962848d9f644262fa27e6f777cda4d35"], + ["discord.js", "https://github.com/NotEnoughUpdates/discord.js.git#commit=c71d1042962848d9f644262fa27e6f777cda4d35"], ["esbuild", "npm:0.12.15"], ["eslint", "npm:7.30.0"], ["eslint-config-prettier", "virtual:d7ae587dddcefd495158f5c047acecbca3203324d75e681c7d8657c07f901f74e152f0b39978f7428d3a91daad7b5020c47ece28de69c22fcbd49d04707bf15c#npm:8.3.0"], @@ -829,7 +829,7 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) { ["common-tags", "npm:1.8.0"], ["discord-akairo", "https://github.com/NotEnoughUpdates/discord-akairo.git#commit=58e5a8610d9cb47257cb163a94e284113a39a62b"], ["discord-api-types", "npm:0.19.0-next.f393ba520d7d6d2aacaca7b3ca5d355fab614f6e"], - ["discord-js-structures", "https://github.com/NotEnoughUpdates/discord.js.git#commit=c71d1042962848d9f644262fa27e6f777cda4d35"], + ["discord.js", "https://github.com/NotEnoughUpdates/discord.js.git#commit=c71d1042962848d9f644262fa27e6f777cda4d35"], ["esbuild", "npm:0.12.15"], ["eslint", "npm:7.30.0"], ["eslint-config-prettier", "virtual:d7ae587dddcefd495158f5c047acecbca3203324d75e681c7d8657c07f901f74e152f0b39978f7428d3a91daad7b5020c47ece28de69c22fcbd49d04707bf15c#npm:8.3.0"], @@ -1126,11 +1126,11 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) { "linkType": "HARD", }] ]], - ["discord-js-structures", [ + ["discord.js", [ ["https://github.com/NotEnoughUpdates/discord.js.git#commit=c71d1042962848d9f644262fa27e6f777cda4d35", { - "packageLocation": "./.yarn/cache/discord-js-structures-https-38d21f1d79-6c25167ca9.zip/node_modules/discord-js-structures/", + "packageLocation": "./.yarn/cache/discord.js-https-cb3a4c165c-c5767e602e.zip/node_modules/discord.js/", "packageDependencies": [ - ["discord-js-structures", "https://github.com/NotEnoughUpdates/discord.js.git#commit=c71d1042962848d9f644262fa27e6f777cda4d35"], + ["discord.js", "https://github.com/NotEnoughUpdates/discord.js.git#commit=c71d1042962848d9f644262fa27e6f777cda4d35"], ["@discordjs/builders", "npm:0.2.0"], ["@discordjs/collection", "npm:0.1.6"], ["@discordjs/form-data", "npm:3.0.1"], diff --git a/.vscode/extensions.json b/.vscode/extensions.json index e6ce365..08b7552 100644 --- a/.vscode/extensions.json +++ b/.vscode/extensions.json @@ -1,4 +1,4 @@ -/* prettier-ignore */ { +/* prettier-ignore */{ "recommendations": [ "aaron-bond.better-comments", "arcanis.vscode-zipfs", diff --git a/.vscode/settings.json b/.vscode/settings.json index ff71740..d8b509c 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,4 +1,4 @@ -/* prettier-ignore */ { +/* prettier-ignore */{ "files.exclude": { "**/.git": true, "**/.svn": true, diff --git a/.yarn/sdks/typescript/bin/tsc b/.yarn/sdks/typescript/bin/tsc index 06e51d0..5608e57 100755 --- a/.yarn/sdks/typescript/bin/tsc +++ b/.yarn/sdks/typescript/bin/tsc @@ -4,7 +4,7 @@ const {existsSync} = require(`fs`); const {createRequire, createRequireFromPath} = require(`module`); const {resolve} = require(`path`); -const relPnpApiPath = "../../../../.pnp.js"; +const relPnpApiPath = "../../../../.pnp.cjs"; const absPnpApiPath = resolve(__dirname, relPnpApiPath); const absRequire = (createRequire || createRequireFromPath)(absPnpApiPath); diff --git a/.yarn/sdks/typescript/bin/tsserver b/.yarn/sdks/typescript/bin/tsserver index 2d03f3d..cd7d557 100755 --- a/.yarn/sdks/typescript/bin/tsserver +++ b/.yarn/sdks/typescript/bin/tsserver @@ -4,7 +4,7 @@ const {existsSync} = require(`fs`); const {createRequire, createRequireFromPath} = require(`module`); const {resolve} = require(`path`); -const relPnpApiPath = "../../../../.pnp.js"; +const relPnpApiPath = "../../../../.pnp.cjs"; const absPnpApiPath = resolve(__dirname, relPnpApiPath); const absRequire = (createRequire || createRequireFromPath)(absPnpApiPath); diff --git a/.yarn/sdks/typescript/lib/tsc.js b/.yarn/sdks/typescript/lib/tsc.js index e030711..16042d0 100644 --- a/.yarn/sdks/typescript/lib/tsc.js +++ b/.yarn/sdks/typescript/lib/tsc.js @@ -4,7 +4,7 @@ const {existsSync} = require(`fs`); const {createRequire, createRequireFromPath} = require(`module`); const {resolve} = require(`path`); -const relPnpApiPath = "../../../../.pnp.js"; +const relPnpApiPath = "../../../../.pnp.cjs"; const absPnpApiPath = resolve(__dirname, relPnpApiPath); const absRequire = (createRequire || createRequireFromPath)(absPnpApiPath); diff --git a/.yarn/sdks/typescript/lib/tsserver.js b/.yarn/sdks/typescript/lib/tsserver.js index 488c4b8..1c0f94d 100644 --- a/.yarn/sdks/typescript/lib/tsserver.js +++ b/.yarn/sdks/typescript/lib/tsserver.js @@ -4,12 +4,16 @@ const {existsSync} = require(`fs`); const {createRequire, createRequireFromPath} = require(`module`); const {resolve} = require(`path`); -const relPnpApiPath = "../../../../.pnp.js"; +const relPnpApiPath = "../../../../.pnp.cjs"; const absPnpApiPath = resolve(__dirname, relPnpApiPath); const absRequire = (createRequire || createRequireFromPath)(absPnpApiPath); const moduleWrapper = tsserver => { + if (!process.versions.pnp) { + return tsserver; + } + const {isAbsolute} = require(`path`); const pnpApi = require(`pnpapi`); @@ -106,7 +110,7 @@ const moduleWrapper = tsserver => { const {onMessage: originalOnMessage, send: originalSend} = Session.prototype; let hostInfo = `unknown`; - return Object.assign(Session.prototype, { + Object.assign(Session.prototype, { onMessage(/** @type {string} */ message) { const parsedMessage = JSON.parse(message) @@ -130,6 +134,8 @@ const moduleWrapper = tsserver => { }))); } }); + + return tsserver; }; if (existsSync(absPnpApiPath)) { diff --git a/.yarn/sdks/typescript/lib/tsserverlibrary.js b/.yarn/sdks/typescript/lib/tsserverlibrary.js new file mode 100644 index 0000000..77e7ef5 --- /dev/null +++ b/.yarn/sdks/typescript/lib/tsserverlibrary.js @@ -0,0 +1,149 @@ +#!/usr/bin/env node + +const {existsSync} = require(`fs`); +const {createRequire, createRequireFromPath} = require(`module`); +const {resolve} = require(`path`); + +const relPnpApiPath = "../../../../.pnp.cjs"; + +const absPnpApiPath = resolve(__dirname, relPnpApiPath); +const absRequire = (createRequire || createRequireFromPath)(absPnpApiPath); + +const moduleWrapper = tsserver => { + if (!process.versions.pnp) { + return tsserver; + } + + const {isAbsolute} = require(`path`); + const pnpApi = require(`pnpapi`); + + const isVirtual = str => str.match(/\/(\$\$virtual|__virtual__)\//); + const normalize = str => str.replace(/\\/g, `/`).replace(/^\/?/, `/`); + + const dependencyTreeRoots = new Set(pnpApi.getDependencyTreeRoots().map(locator => { + return `${locator.name}@${locator.reference}`; + })); + + // VSCode sends the zip paths to TS using the "zip://" prefix, that TS + // doesn't understand. This layer makes sure to remove the protocol + // before forwarding it to TS, and to add it back on all returned paths. + + function toEditorPath(str) { + // We add the `zip:` prefix to both `.zip/` paths and virtual paths + if (isAbsolute(str) && !str.match(/^\^zip:/) && (str.match(/\.zip\//) || isVirtual(str))) { + // We also take the opportunity to turn virtual paths into physical ones; + // this makes it much easier to work with workspaces that list peer + // dependencies, since otherwise Ctrl+Click would bring us to the virtual + // file instances instead of the real ones. + // + // We only do this to modules owned by the the dependency tree roots. + // This avoids breaking the resolution when jumping inside a vendor + // with peer dep (otherwise jumping into react-dom would show resolution + // errors on react). + // + const resolved = isVirtual(str) ? pnpApi.resolveVirtual(str) : str; + if (resolved) { + const locator = pnpApi.findPackageLocator(resolved); + if (locator && dependencyTreeRoots.has(`${locator.name}@${locator.reference}`)) { + str = resolved; + } + } + + str = normalize(str); + + if (str.match(/\.zip\//)) { + switch (hostInfo) { + // Absolute VSCode `Uri.fsPath`s need to start with a slash. + // VSCode only adds it automatically for supported schemes, + // so we have to do it manually for the `zip` scheme. + // The path needs to start with a caret otherwise VSCode doesn't handle the protocol + // + // Ref: https://github.com/microsoft/vscode/issues/105014#issuecomment-686760910 + // + case `vscode`: { + str = `^zip:${str}`; + } break; + + // To make "go to definition" work, + // We have to resolve the actual file system path from virtual path + // and convert scheme to supported by [vim-rzip](https://github.com/lbrayner/vim-rzip) + case `coc-nvim`: { + str = normalize(resolved).replace(/\.zip\//, `.zip::`); + str = resolve(`zipfile:${str}`); + } break; + + default: { + str = `zip:${str}`; + } break; + } + } + } + + return str; + } + + function fromEditorPath(str) { + return process.platform === `win32` + ? str.replace(/^\^?zip:\//, ``) + : str.replace(/^\^?zip:/, ``); + } + + // Force enable 'allowLocalPluginLoads' + // TypeScript tries to resolve plugins using a path relative to itself + // which doesn't work when using the global cache + // https://github.com/microsoft/TypeScript/blob/1b57a0395e0bff191581c9606aab92832001de62/src/server/project.ts#L2238 + // VSCode doesn't want to enable 'allowLocalPluginLoads' due to security concerns but + // TypeScript already does local loads and if this code is running the user trusts the workspace + // https://github.com/microsoft/vscode/issues/45856 + const ConfiguredProject = tsserver.server.ConfiguredProject; + const {enablePluginsWithOptions: originalEnablePluginsWithOptions} = ConfiguredProject.prototype; + ConfiguredProject.prototype.enablePluginsWithOptions = function() { + this.projectService.allowLocalPluginLoads = true; + return originalEnablePluginsWithOptions.apply(this, arguments); + }; + + // And here is the point where we hijack the VSCode <-> TS communications + // by adding ourselves in the middle. We locate everything that looks + // like an absolute path of ours and normalize it. + + const Session = tsserver.server.Session; + const {onMessage: originalOnMessage, send: originalSend} = Session.prototype; + let hostInfo = `unknown`; + + Object.assign(Session.prototype, { + onMessage(/** @type {string} */ message) { + const parsedMessage = JSON.parse(message) + + if ( + parsedMessage != null && + typeof parsedMessage === `object` && + parsedMessage.arguments && + typeof parsedMessage.arguments.hostInfo === `string` + ) { + hostInfo = parsedMessage.arguments.hostInfo; + } + + return originalOnMessage.call(this, JSON.stringify(parsedMessage, (key, value) => { + return typeof value === `string` ? fromEditorPath(value) : value; + })); + }, + + send(/** @type {any} */ msg) { + return originalSend.call(this, JSON.parse(JSON.stringify(msg, (key, value) => { + return typeof value === `string` ? toEditorPath(value) : value; + }))); + } + }); + + return tsserver; +}; + +if (existsSync(absPnpApiPath)) { + if (!process.versions.pnp) { + // Setup the environment to be able to require typescript/lib/tsserverlibrary.js + require(absPnpApiPath).setup(); + } +} + +// Defer to the real typescript/lib/tsserverlibrary.js your application uses +module.exports = moduleWrapper(absRequire(`typescript/lib/tsserverlibrary.js`)); diff --git a/.yarn/sdks/typescript/lib/typescript.js b/.yarn/sdks/typescript/lib/typescript.js index 7e3c852..cbdbf15 100644 --- a/.yarn/sdks/typescript/lib/typescript.js +++ b/.yarn/sdks/typescript/lib/typescript.js @@ -4,7 +4,7 @@ const {existsSync} = require(`fs`); const {createRequire, createRequireFromPath} = require(`module`); const {resolve} = require(`path`); -const relPnpApiPath = "../../../../.pnp.js"; +const relPnpApiPath = "../../../../.pnp.cjs"; const absPnpApiPath = resolve(__dirname, relPnpApiPath); const absRequire = (createRequire || createRequireFromPath)(absPnpApiPath); diff --git a/package.json b/package.json index 28d3351..ece0619 100644 --- a/package.json +++ b/package.json @@ -40,7 +40,7 @@ "common-tags": "^1.8.0", "discord-akairo": "NotEnoughUpdates/discord-akairo", "discord-api-types": "0.19.0-next.f393ba520d7d6d2aacaca7b3ca5d355fab614f6e", - "discord-js-structures": "NotEnoughUpdates/discord.js", + "discord.js": "NotEnoughUpdates/discord.js", "got": "^11.8.2", "humanize-duration": "^3.27.0", "moment": "^2.29.1", 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 ); @@ -613,7 +613,7 @@ __metadata: common-tags: ^1.8.0 discord-akairo: NotEnoughUpdates/discord-akairo discord-api-types: 0.19.0-next.f393ba520d7d6d2aacaca7b3ca5d355fab614f6e - discord-js-structures: NotEnoughUpdates/discord.js + discord.js: NotEnoughUpdates/discord.js esbuild: ^0.12.11 eslint: ^7.29.0 eslint-config-prettier: ^8.3.0 @@ -863,9 +863,9 @@ discord-akairo@NotEnoughUpdates/discord-akairo: languageName: node linkType: hard -discord-js-structures@NotEnoughUpdates/discord.js: +discord.js@NotEnoughUpdates/discord.js: version: 13.0.0-dev - resolution: "discord-js-structures@https://github.com/NotEnoughUpdates/discord.js.git#commit=c71d1042962848d9f644262fa27e6f777cda4d35" + resolution: "discord.js@https://github.com/NotEnoughUpdates/discord.js.git#commit=c71d1042962848d9f644262fa27e6f777cda4d35" dependencies: "@discordjs/builders": ^0.2.0 "@discordjs/collection": ^0.1.6 @@ -876,7 +876,7 @@ discord-js-structures@NotEnoughUpdates/discord.js: discord-api-types: ^0.19.0-next.f393ba520d7d6d2aacaca7b3ca5d355fab614f6e node-fetch: ^2.6.1 ws: ^7.5.1 - checksum: 6c25167ca95052c47516bd2f3ae611920b19592c897f7680cab9df951361f693a7c813f24e2da2dc5f558229a0525b6fc7aed62d3d0555aebb2afa09c718f6b1 + checksum: c5767e602ead72369d5bf43a03ca9931283e683374ad0e071bea7658c50541d24a70a834964e1a3e0af840d7d14ddb990d262a87b9f7002b3e64881824b85673 languageName: node linkType: hard |