aboutsummaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
authorIRONM00N <64110067+IRONM00N@users.noreply.github.com>2021-07-08 22:19:24 -0400
committerIRONM00N <64110067+IRONM00N@users.noreply.github.com>2021-07-08 22:19:24 -0400
commit820f55fc9bc8a4540666c03a414d68bcfbead4fc (patch)
treec6f42825fd5e13ee0d78c07a4533ea83c0f150f9 /src/lib
parent86be44fc0485085a77b7945a22f579e6b3a5b510 (diff)
downloadtanzanite-820f55fc9bc8a4540666c03a414d68bcfbead4fc.tar.gz
tanzanite-820f55fc9bc8a4540666c03a414d68bcfbead4fc.tar.bz2
tanzanite-820f55fc9bc8a4540666c03a414d68bcfbead4fc.zip
fix breaking changes
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/extensions/discord-akairo/BushClient.ts8
-rw-r--r--src/lib/extensions/discord-akairo/BushClientUtil.ts30
-rw-r--r--src/lib/extensions/discord-akairo/BushTask.ts5
-rw-r--r--src/lib/extensions/discord.js/BushApplicationCommandManager.ts7
-rw-r--r--src/lib/extensions/discord.js/BushApplicationCommandPermissionsManager.ts11
-rw-r--r--src/lib/extensions/discord.js/BushGuildMember.ts2
-rw-r--r--src/lib/extensions/discord.js/BushMessage.ts4
-rw-r--r--src/lib/extensions/discord.js/BushNewsChannel.ts4
-rw-r--r--src/lib/extensions/discord.js/BushThreadManager.ts2
-rw-r--r--src/lib/extensions/discord.js/BushThreadMemberManager.ts4
10 files changed, 43 insertions, 34 deletions
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);
}
}