aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorIRONM00N <64110067+IRONM00N@users.noreply.github.com>2022-03-05 15:20:08 -0500
committerIRONM00N <64110067+IRONM00N@users.noreply.github.com>2022-03-05 15:20:08 -0500
commit1947c715f5ff846316b2d921b78f1a71a2892d1b (patch)
treef6bdc2d28537fd63f7e8c26db1cb4928cb9c9f13 /src
parent3c56bbcf795725b65192409b3211d92c097f8c82 (diff)
downloadtanzanite-1947c715f5ff846316b2d921b78f1a71a2892d1b.tar.gz
tanzanite-1947c715f5ff846316b2d921b78f1a71a2892d1b.tar.bz2
tanzanite-1947c715f5ff846316b2d921b78f1a71a2892d1b.zip
chore: upgrade deps
Diffstat (limited to 'src')
-rw-r--r--src/commands/dev/test.ts8
-rw-r--r--src/commands/info/snowflake.ts10
-rw-r--r--src/lib/common/ButtonPaginator.ts11
-rw-r--r--src/lib/extensions/discord.js/BushDMChannel.ts2
-rw-r--r--src/lib/extensions/discord.js/BushMessage.ts4
-rw-r--r--src/listeners/commands/commandError.ts8
-rw-r--r--src/listeners/commands/commandStarted.ts14
-rw-r--r--src/listeners/message/blacklistedFile.ts2
-rw-r--r--src/listeners/message/directMessage.ts6
9 files changed, 38 insertions, 27 deletions
diff --git a/src/commands/dev/test.ts b/src/commands/dev/test.ts
index cca40a6..3f9cd80 100644
--- a/src/commands/dev/test.ts
+++ b/src/commands/dev/test.ts
@@ -2,13 +2,13 @@ import { BushCommand, ButtonPaginator, Shared, type BushMessage } from '#lib';
import { Routes } from 'discord-api-types/rest/v9';
import {
ActionRow,
- ActionRowComponent,
ButtonComponent,
ButtonStyle,
Embed,
GatewayDispatchEvents,
type ApplicationCommand,
- type Collection
+ type Collection,
+ type MessageActionRowComponent
} from 'discord.js';
import badLinksSecretArray from '../../lib/badlinks-secret.js';
import badLinksArray from '../../lib/badlinks.js';
@@ -81,7 +81,7 @@ export default class TestCommand extends BushCommand {
);
return await message.util.reply({ content: 'Test', embeds: [embed], components: [buttonRow] });
} else if (['lots of buttons'].includes(args?.feature?.toLowerCase())) {
- const ButtonRows: ActionRow<ActionRowComponent>[] = [];
+ const ButtonRows: ActionRow<MessageActionRowComponent>[] = [];
for (let a = 1; a <= 5; a++) {
const row = new ActionRow();
for (let b = 1; b <= 5; b++) {
@@ -113,7 +113,7 @@ export default class TestCommand extends BushCommand {
const embeds = colors.map((c, i) => ({ ...o, title: `Embed Title ${i}`, color: c }));
- const ButtonRows: ActionRow<ActionRowComponent>[] = [];
+ const ButtonRows: ActionRow<MessageActionRowComponent>[] = [];
for (let a = 1; a <= 5; a++) {
const row = new ActionRow();
for (let b = 1; b <= 5; b++) {
diff --git a/src/commands/info/snowflake.ts b/src/commands/info/snowflake.ts
index c64a286..d9ca5fc 100644
--- a/src/commands/info/snowflake.ts
+++ b/src/commands/info/snowflake.ts
@@ -44,8 +44,14 @@ export default class SnowflakeCommand extends BushCommand {
const channel = client.channels.resolve(snowflake)!;
const channelInfo = [`**Type:** ${BushChannelType[channel.type]}`];
if (channel.isDM()) {
- channelInfo.push(`**Recipient:** ${util.discord.escapeMarkdown(channel.recipient.tag)} (${channel.recipient.id})`);
- snowflakeEmbed.setTitle(`:snowflake: DM with ${util.discord.escapeMarkdown(channel.recipient.tag)} \`[Channel]\``);
+ channelInfo.push(
+ `**Recipient:** ${util.discord.escapeMarkdown(channel.recipient?.tag ?? '¯\\_(ツ)_/¯')} (${
+ channel.recipient?.id ?? '¯\\_(ツ)_/¯'
+ })`
+ );
+ snowflakeEmbed.setTitle(
+ `:snowflake: DM with ${util.discord.escapeMarkdown(channel.recipient?.tag ?? '¯\\_(ツ)_/¯')} \`[Channel]\``
+ );
} else if (
channel.isCategory() ||
channel.isNews() ||
diff --git a/src/lib/common/ButtonPaginator.ts b/src/lib/common/ButtonPaginator.ts
index 15c07fa..e3d4207 100644
--- a/src/lib/common/ButtonPaginator.ts
+++ b/src/lib/common/ButtonPaginator.ts
@@ -1,7 +1,14 @@
import { DeleteButton, type BushMessage, type BushSlashMessage } from '#lib';
import { CommandUtil } from 'discord-akairo';
import { APIEmbed } from 'discord-api-types/v9';
-import { ActionRow, ActionRowComponent, ButtonComponent, ButtonStyle, Embed, type MessageComponentInteraction } from 'discord.js';
+import {
+ ActionRow,
+ ButtonComponent,
+ ButtonStyle,
+ Embed,
+ type MessageActionRowComponent,
+ type MessageComponentInteraction
+} from 'discord.js';
/**
* Sends multiple embeds with controls to switch between them
@@ -170,7 +177,7 @@ export class ButtonPaginator {
* @param disableAll Whether to disable all buttons
* @returns The generated {@link ActionRow}
*/
- protected getPaginationRow(disableAll = false): ActionRow<ActionRowComponent> {
+ protected getPaginationRow(disableAll = false): ActionRow<MessageActionRowComponent> {
return new ActionRow().addComponents(
new ButtonComponent({
style: ButtonStyle.Primary,
diff --git a/src/lib/extensions/discord.js/BushDMChannel.ts b/src/lib/extensions/discord.js/BushDMChannel.ts
index d73ad70..dc7d309 100644
--- a/src/lib/extensions/discord.js/BushDMChannel.ts
+++ b/src/lib/extensions/discord.js/BushDMChannel.ts
@@ -22,7 +22,6 @@ import type { RawDMChannelData } from 'discord.js/typings/rawDataTypes';
export class BushDMChannel extends DMChannel {
public declare readonly client: BushClient;
public declare messages: BushMessageManager;
- public declare recipient: BushUser;
public constructor(client: BushClient, data?: RawDMChannelData) {
super(client, data);
@@ -30,6 +29,7 @@ export class BushDMChannel extends DMChannel {
}
export interface BushDMChannel extends DMChannel {
+ get recipient(): BushUser | null;
isText(): this is BushTextChannel;
isDM(): this is BushDMChannel;
isDMBased(): this is PartialGroupDMChannel | BushDMChannel;
diff --git a/src/lib/extensions/discord.js/BushMessage.ts b/src/lib/extensions/discord.js/BushMessage.ts
index c424d12..48e1792 100644
--- a/src/lib/extensions/discord.js/BushMessage.ts
+++ b/src/lib/extensions/discord.js/BushMessage.ts
@@ -10,8 +10,8 @@ import type {
BushUser
} from '#lib';
import {
- ActionRowComponent,
Message,
+ MessageActionRowComponent,
type EmojiIdentifierResolvable,
type If,
type MessageEditOptions,
@@ -55,7 +55,7 @@ export interface BushMessage<Cached extends boolean = boolean> extends Message<C
react(emoji: EmojiIdentifierResolvable): Promise<BushMessageReaction>;
removeAttachments(): Promise<BushMessage>;
reply(options: string | MessagePayload | ReplyMessageOptions): Promise<BushMessage>;
- resolveComponent(customId: string): ActionRowComponent | null;
+ resolveComponent(customId: string): MessageActionRowComponent | null;
startThread(options: StartThreadOptions): Promise<BushThreadChannel>;
suppressEmbeds(suppress?: boolean): Promise<BushMessage>;
unpin(): Promise<BushMessage>;
diff --git a/src/listeners/commands/commandError.ts b/src/listeners/commands/commandError.ts
index 83bb327..048c597 100644
--- a/src/listeners/commands/commandError.ts
+++ b/src/listeners/commands/commandError.ts
@@ -22,7 +22,7 @@ export default class CommandErrorListener extends BushListener {
try {
const isSlash = message.util.isSlash;
const errorNum = Math.floor(Math.random() * 6969696969) + 69; // hehe funny number
- const channel = message.channel?.isDM() ? message.channel?.recipient.tag : (<GuildTextBasedChannel>message.channel)?.name;
+ const channel = message.channel?.isDM() ? message.channel.recipient?.tag : (<GuildTextBasedChannel>message.channel)?.name;
const command = _command ?? message.util.parsed?.command;
client.sentry.captureException(error, {
@@ -33,10 +33,10 @@ export default class CommandErrorListener extends BushListener {
'message.id': message.id,
'message.type': message.util.isSlash ? 'slash' : 'normal',
'message.parsed.content': message.util.parsed?.content,
- 'channel.id': message.channel?.isDM() ? message.channel?.recipient.id : (<GuildTextBasedChannel>message.channel)?.id,
+ 'channel.id': (message.channel?.isDM() ? message.channel.recipient?.id : message.channel?.id) ?? '¯_(ツ)_/¯',
'channel.name': channel,
- 'guild.id': message.guild?.id,
- 'guild.name': message.guild?.name,
+ 'guild.id': message.guild?.id ?? '¯_(ツ)_/¯',
+ 'guild.name': message.guild?.name ?? '¯_(ツ)_/¯',
'environment': client.config.environment
}
});
diff --git a/src/listeners/commands/commandStarted.ts b/src/listeners/commands/commandStarted.ts
index 419191a..833eff0 100644
--- a/src/listeners/commands/commandStarted.ts
+++ b/src/listeners/commands/commandStarted.ts
@@ -1,6 +1,6 @@
import { BushListener, type BushCommandHandlerEvents } from '#lib';
import { Severity } from '@sentry/types';
-import { ChannelType, GuildTextBasedChannel } from 'discord.js';
+import { ChannelType } from 'discord.js';
export default class CommandStartedListener extends BushListener {
public constructor() {
@@ -20,13 +20,11 @@ export default class CommandStartedListener extends BushListener {
'command.name': command?.id,
'message.id': message.id,
'message.type': message.util.isSlash ? 'slash' : 'normal',
- 'message.parsed.content': message.util.parsed!.content,
- 'channel.id': message.channel.isDMBased() ? message.channel!.recipient.id : message.channel?.id,
- 'channel.name': message.channel.isDMBased()
- ? message.channel.recipient.tag
- : (<GuildTextBasedChannel>message.channel)?.name,
- 'guild.id': message.guild?.id,
- 'guild.name': message.guild?.name,
+ 'message.parsed.content': message.util.parsed?.content,
+ 'channel.id': (message.channel.isDMBased() ? message.channel.recipient?.id : message.channel?.id) ?? '¯_(ツ)_/¯',
+ 'channel.name': (message.channel.isDMBased() ? message.channel.recipient?.tag : message.channel?.name) ?? '¯_(ツ)_/¯',
+ 'guild.id': message.guild?.id ?? '¯_(ツ)_/¯',
+ 'guild.name': message.guild?.name ?? '¯_(ツ)_/¯',
'environment': client.config.environment
}
});
diff --git a/src/listeners/message/blacklistedFile.ts b/src/listeners/message/blacklistedFile.ts
index 38803f5..77c4971 100644
--- a/src/listeners/message/blacklistedFile.ts
+++ b/src/listeners/message/blacklistedFile.ts
@@ -146,7 +146,7 @@ export default class BlacklistedFileListener extends BushListener {
void client.console.warn(
'blacklistedFile',
`Failed to delete <<${foundFiles.map((f) => f.description).join(' and ')}>> sent by <<${message.author.tag}>> in <<${
- message.channel.type === ChannelType.DM ? `${message.channel.recipient.tag}'s DMs` : message.channel.name
+ message.channel.type === ChannelType.DM ? `${message.channel.recipient?.tag}'s DMs` : message.channel.name
}>>.`
);
}
diff --git a/src/listeners/message/directMessage.ts b/src/listeners/message/directMessage.ts
index df4d578..575fbda 100644
--- a/src/listeners/message/directMessage.ts
+++ b/src/listeners/message/directMessage.ts
@@ -14,7 +14,7 @@ export default class DirectMessageListener extends BushListener {
if (message.channel.type === ChannelType.DM) {
if (!(message.author.id == client.user!.id) && message.author.bot) return;
if (client.cache.global.blacklistedUsers.includes(message.author.id)) return;
- const dmLogEmbed = new Embed().setTimestamp().setFooter({ text: `User ID • ${message.channel.recipient.id}` });
+ const dmLogEmbed = new Embed().setTimestamp().setFooter({ text: `User ID • ${message.channel.recipientId}` });
if (message.author.id != client.user!.id) {
dmLogEmbed
@@ -27,8 +27,8 @@ export default class DirectMessageListener extends BushListener {
} else {
dmLogEmbed
.setAuthor({
- name: `To: ${message.channel.recipient.username}`,
- iconURL: `${message.channel.recipient.displayAvatarURL()}`
+ name: `To: ${message.channel.recipient?.username}`,
+ iconURL: `${message.channel.recipient?.displayAvatarURL()}`
})
.setDescription(`**DM:**\n${message}`)
.setColor(util.colors.red)