diff options
Diffstat (limited to 'src/lib')
-rw-r--r-- | src/lib/common/ButtonPaginator.ts | 16 | ||||
-rw-r--r-- | src/lib/extensions/discord-akairo/BushCommandUtil.ts | 7 | ||||
-rw-r--r-- | src/lib/extensions/discord-akairo/BushSlashMessage.ts | 2 | ||||
-rw-r--r-- | src/lib/extensions/discord.js/BushClientEvents.d.ts | 4 | ||||
-rw-r--r-- | src/lib/extensions/discord.js/BushMessage.ts | 2 | ||||
-rw-r--r-- | src/lib/index.ts | 24 | ||||
-rw-r--r-- | src/lib/utils/BushConstants.ts | 70 |
7 files changed, 78 insertions, 47 deletions
diff --git a/src/lib/common/ButtonPaginator.ts b/src/lib/common/ButtonPaginator.ts index 68955cc..6d4c49a 100644 --- a/src/lib/common/ButtonPaginator.ts +++ b/src/lib/common/ButtonPaginator.ts @@ -85,7 +85,7 @@ export class ButtonPaginator { } protected async collect(interaction: MessageComponentInteraction) { - if (interaction.user.id !== this.message.author.id || !client.config.owners.includes(interaction.user.id)) + if (interaction.user.id !== this.message.author.id && !client.config.owners.includes(interaction.user.id)) return await interaction?.deferUpdate().catch(() => undefined); switch (interaction.customId) { @@ -118,12 +118,14 @@ export class ButtonPaginator { } protected async end() { - if (!this.deleteOnExit) - return await this.sentMessage!.edit({ - content: this.text, - embeds: [this.embeds[this.curPage]], - components: [this.getPaginationRow(true)] - }).catch(() => undefined); + if (this.sentMessage && !this.sentMessage.deleted) + return await this.sentMessage + .edit({ + content: this.text, + embeds: [this.embeds[this.curPage]], + components: [this.getPaginationRow(true)] + }) + .catch(() => undefined); } protected async edit(interaction: MessageComponentInteraction) { diff --git a/src/lib/extensions/discord-akairo/BushCommandUtil.ts b/src/lib/extensions/discord-akairo/BushCommandUtil.ts index bda0e74..7720d57 100644 --- a/src/lib/extensions/discord-akairo/BushCommandUtil.ts +++ b/src/lib/extensions/discord-akairo/BushCommandUtil.ts @@ -4,18 +4,19 @@ import { Collection } from 'discord.js'; import { BushMessage } from '../discord.js/BushMessage'; import { BushCommand } from './BushCommand'; import { BushCommandHandler } from './BushCommandHandler'; +import { BushSlashMessage } from './BushSlashMessage'; export interface BushParsedComponentData extends ParsedComponentData { command?: BushCommand; } -export class BushCommandUtil extends CommandUtil { +export class BushCommandUtil<BushMessageType extends BushMessage | BushSlashMessage> extends CommandUtil<BushMessageType> { public declare parsed: BushParsedComponentData | null; public declare handler: BushCommandHandler; - public declare message: BushMessage; + public declare message: BushMessageType; public declare messages: Collection<Snowflake, BushMessage> | null; - public constructor(handler: BushCommandHandler, message: BushMessage) { + public constructor(handler: BushCommandHandler, message: BushMessageType) { super(handler, message); } } diff --git a/src/lib/extensions/discord-akairo/BushSlashMessage.ts b/src/lib/extensions/discord-akairo/BushSlashMessage.ts index d75d0a7..b5e48ea 100644 --- a/src/lib/extensions/discord-akairo/BushSlashMessage.ts +++ b/src/lib/extensions/discord-akairo/BushSlashMessage.ts @@ -8,7 +8,7 @@ import { BushCommandUtil } from './BushCommandUtil'; export class BushSlashMessage extends AkairoMessage { public declare client: BushClient; - public declare util: BushCommandUtil; + public declare util: BushCommandUtil<BushSlashMessage>; public declare author: BushUser; public declare member: BushGuildMember | null; public constructor(client: BushClient, interaction: CommandInteraction) { diff --git a/src/lib/extensions/discord.js/BushClientEvents.d.ts b/src/lib/extensions/discord.js/BushClientEvents.d.ts index 4538fbb..b16f632 100644 --- a/src/lib/extensions/discord.js/BushClientEvents.d.ts +++ b/src/lib/extensions/discord.js/BushClientEvents.d.ts @@ -25,8 +25,8 @@ import { PartialBushMessageReaction, PartialBushUser } from '@lib'; +import { AkairoClientEvents } from 'discord-akairo'; import { - ClientEvents, Collection, Interaction, InvalidRequestWarningData, @@ -38,7 +38,7 @@ import { } from 'discord.js'; import { BushGuildBan } from './BushGuildBan'; -export interface BushClientEvents extends ClientEvents { +export interface BushClientEvents extends AkairoClientEvents { applicationCommandCreate: [command: BushApplicationCommand]; applicationCommandDelete: [command: BushApplicationCommand]; applicationCommandUpdate: [ diff --git a/src/lib/extensions/discord.js/BushMessage.ts b/src/lib/extensions/discord.js/BushMessage.ts index f2dd02c..4481910 100644 --- a/src/lib/extensions/discord.js/BushMessage.ts +++ b/src/lib/extensions/discord.js/BushMessage.ts @@ -13,7 +13,7 @@ export type PartialBushMessage = Partialize< >; export class BushMessage extends Message { public declare readonly client: BushClient; - public override util!: BushCommandUtil; + public override util!: BushCommandUtil<BushMessage>; public declare readonly guild: BushGuild | null; public declare readonly member: BushGuildMember | null; public declare author: BushUser; diff --git a/src/lib/index.ts b/src/lib/index.ts index 1e789e5..ec4dcb2 100644 --- a/src/lib/index.ts +++ b/src/lib/index.ts @@ -1,3 +1,9 @@ +export * from './common/AutoMod'; +export * from './common/ButtonPaginator'; +export * from './common/DeleteButton'; +export * from './common/Format'; +export * from './common/Moderation'; +export * from './common/util/Arg'; export * from './extensions/discord-akairo/BushArgumentTypeCaster'; export * from './extensions/discord-akairo/BushClient'; export * from './extensions/discord-akairo/BushClientUtil'; @@ -13,16 +19,29 @@ export * from './extensions/discord-akairo/BushTask'; export * from './extensions/discord-akairo/BushTaskHandler'; export * from './extensions/discord.js/BushActivity'; export * from './extensions/discord.js/BushApplicationCommand'; +export type { BushApplicationCommandManager } from './extensions/discord.js/BushApplicationCommandManager'; +export type { BushApplicationCommandPermissionsManager } from './extensions/discord.js/BushApplicationCommandPermissionsManager'; +export type { BushBaseGuildEmojiManager } from './extensions/discord.js/BushBaseGuildEmojiManager'; export * from './extensions/discord.js/BushButtonInteraction'; export * from './extensions/discord.js/BushCategoryChannel'; +export type { BushChannel } from './extensions/discord.js/BushChannel'; +export type { BushChannelManager } from './extensions/discord.js/BushChannelManager'; +export type { BushClientEvents } from './extensions/discord.js/BushClientEvents'; +export type { BushClientUser } from './extensions/discord.js/BushClientUser'; export * from './extensions/discord.js/BushCommandInteraction'; export * from './extensions/discord.js/BushDMChannel'; export * from './extensions/discord.js/BushEmoji'; export * from './extensions/discord.js/BushGuild'; +export type { BushGuildApplicationCommandManager } from './extensions/discord.js/BushGuildApplicationCommandManager'; +export type { BushGuildBan } from './extensions/discord.js/BushGuildBan'; export * from './extensions/discord.js/BushGuildChannel'; export * from './extensions/discord.js/BushGuildEmoji'; +export type { BushGuildEmojiRoleManager } from './extensions/discord.js/BushGuildEmojiRoleManager'; +export type { BushGuildManager } from './extensions/discord.js/BushGuildManager'; export * from './extensions/discord.js/BushGuildMember'; +export type { BushGuildMemberManager } from './extensions/discord.js/BushGuildMemberManager'; export * from './extensions/discord.js/BushMessage'; +export type { BushMessageManager } from './extensions/discord.js/BushMessageManager'; export * from './extensions/discord.js/BushMessageReaction'; export * from './extensions/discord.js/BushNewsChannel'; export * from './extensions/discord.js/BushPresence'; @@ -34,8 +53,11 @@ export * from './extensions/discord.js/BushStageInstance'; export * from './extensions/discord.js/BushStoreChannel'; export * from './extensions/discord.js/BushTextChannel'; export * from './extensions/discord.js/BushThreadChannel'; +export type { BushThreadManager } from './extensions/discord.js/BushThreadManager'; export * from './extensions/discord.js/BushThreadMember'; +export type { BushThreadMemberManager } from './extensions/discord.js/BushThreadMemberManager'; export * from './extensions/discord.js/BushUser'; +export type { BushUserManager } from './extensions/discord.js/BushUserManager'; export * from './extensions/discord.js/BushVoiceChannel'; export * from './extensions/discord.js/BushVoiceState'; export * from './models/ActivePunishment'; @@ -44,9 +66,11 @@ export * from './models/Global'; export * from './models/Guild'; export * from './models/Level'; export * from './models/ModLog'; +export * from './models/Stat'; export * from './models/StickyRole'; export * from './utils/AllowedMentions'; export * from './utils/BushCache'; export * from './utils/BushConstants'; export * from './utils/BushLogger'; export * from './utils/CanvasProgressBar'; +export * from './utils/Config'; diff --git a/src/lib/utils/BushConstants.ts b/src/lib/utils/BushConstants.ts index 3b41c4f..64208a1 100644 --- a/src/lib/utils/BushConstants.ts +++ b/src/lib/utils/BushConstants.ts @@ -71,6 +71,7 @@ export type Pronoun = | 'Ask me my pronouns' | 'Avoid pronouns, use my name'; +const rawCapeUrl = 'https://raw.githubusercontent.com/NotEnoughUpdates/capes/master/'; export class BushConstants { public static emojis = { success: '<:success:837109864101707807>', @@ -340,44 +341,47 @@ export class BushConstants { maybeNitroDiscrims: ['1111', '2222', '3333', '4444', '5555', '6666', '6969', '7777', '8888', '9999'], - // prettier-ignore capes: [ /* supporter capes */ - { name: 'patreon1', index: 0, purchasable: true }, - { name: 'patreon2', index: 1, purchasable: true }, - { name: 'fade', custom: 'https://raw.githubusercontent.com/NotEnoughUpdates/capes/master/fade.gif', index: 2, purchasable: true }, - { name: 'lava', custom: 'https://raw.githubusercontent.com/NotEnoughUpdates/capes/master/lava.gif', index: 3, purchasable: true }, - { name: 'mcworld', custom: 'https://raw.githubusercontent.com/NotEnoughUpdates/capes/master/mcworld_compressed.gif', index: 4, purchasable: true }, - { name: 'negative', custom: 'https://raw.githubusercontent.com/NotEnoughUpdates/capes/master/negative_compressed.gif', index: 5, purchasable: true }, - { name: 'space', custom: 'https://raw.githubusercontent.com/NotEnoughUpdates/capes/master/space_compressed.gif', index: 6, purchasable: true }, - { name: 'void', custom: 'https://raw.githubusercontent.com/NotEnoughUpdates/capes/master/void.gif', index: 7, purchasable: true }, - { name: 'tunnel', custom: 'https://raw.githubusercontent.com/NotEnoughUpdates/capes/master/tunnel.gif', index: 8, purchasable: true }, + { name: 'patreon1', purchasable: true }, + { name: 'patreon2', purchasable: true }, + { name: 'fade', custom: `${rawCapeUrl}fade.gif`, purchasable: true }, + { name: 'lava', custom: `${rawCapeUrl}lava.gif`, purchasable: true }, + { name: 'mcworld', custom: `${rawCapeUrl}mcworld_compressed.gif`, purchasable: true }, + { name: 'negative', custom: `${rawCapeUrl}negative_compressed.gif`, purchasable: true }, + { name: 'space', custom: `${rawCapeUrl}space_compressed.gif`, purchasable: true }, + { name: 'void', custom: `${rawCapeUrl}void.gif`, purchasable: true }, + { name: 'tunnel', custom: `${rawCapeUrl}tunnel.gif`, purchasable: true }, /* Staff capes */ - { name: 'contrib', index: 9 }, - { name: 'mbstaff', index: 10 }, - { name: 'ironmoon', index: 11 }, - { name: 'gravy', index: 12 }, - { name: 'nullzee', index: 13 }, + { name: 'contrib' }, + { name: 'mbstaff' }, + { name: 'ironmoon' }, + { name: 'gravy' }, + { name: 'nullzee' }, /* partner capes */ - { name: 'thebakery', index: 14 }, - { name: 'dsm', index: 15 }, - { name: 'packshq', index: 16 }, - { name: 'furf', index: 17 }, - { name: 'skytils', index: 18 }, - { name: 'sbp', index: 19 }, - { name: 'subreddit_light', index: 20 }, - { name: 'subreddit_dark', index: 21 }, - {name : 'skyclient', index: 22 }, + { name: 'thebakery' }, + { name: 'dsm' }, + { name: 'packshq' }, + { name: 'furf' }, + { name: 'skytils' }, + { name: 'sbp' }, + { name: 'subreddit_light' }, + { name: 'subreddit_dark' }, + { name: 'skyclient' }, + { name: 'sharex' }, + { name: 'sharex_white' }, /* 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 }, - ], + { name: 'alexxoffi' }, + { name: 'jakethybro' }, + { name: 'krusty' }, + { name: 'krusty_day' }, + { name: 'krusty_night' }, + { name: 'krusty_sunset' }, + { name: 'soldier' }, + { name: 'zera' }, + { name: 'secondpfirsisch' }, + { name: 'stormy_lh' } + ].map((value, index) => ({ ...value, index })), roleMap: [ { name: '*', id: '792453550768390194' }, { name: 'Admin Perms', id: '746541309853958186' }, |