aboutsummaryrefslogtreecommitdiff
path: root/src/commands/info
diff options
context:
space:
mode:
authorIRONM00N <64110067+IRONM00N@users.noreply.github.com>2022-04-20 18:37:22 -0400
committerIRONM00N <64110067+IRONM00N@users.noreply.github.com>2022-04-20 18:37:22 -0400
commitf01be2e3ce820e5737416180efa3e5852ece72c4 (patch)
treea972af929940173e4e2d9f843124a8dfb293bc90 /src/commands/info
parentbcb3dc5fcd21f7626d4c5a8c009dca5658a4436b (diff)
downloadtanzanite-f01be2e3ce820e5737416180efa3e5852ece72c4.tar.gz
tanzanite-f01be2e3ce820e5737416180efa3e5852ece72c4.tar.bz2
tanzanite-f01be2e3ce820e5737416180efa3e5852ece72c4.zip
fix invite link, remove store channel, update to use builder methods, fix breaking changes
Diffstat (limited to 'src/commands/info')
-rw-r--r--src/commands/info/avatar.ts4
-rw-r--r--src/commands/info/botInfo.ts4
-rw-r--r--src/commands/info/color.ts4
-rw-r--r--src/commands/info/guildInfo.ts16
-rw-r--r--src/commands/info/help.ts18
-rw-r--r--src/commands/info/icon.ts4
-rw-r--r--src/commands/info/links.ts10
-rw-r--r--src/commands/info/ping.ts6
-rw-r--r--src/commands/info/pronouns.ts4
-rw-r--r--src/commands/info/snowflake.ts5
-rw-r--r--src/commands/info/userInfo.ts30
11 files changed, 57 insertions, 48 deletions
diff --git a/src/commands/info/avatar.ts b/src/commands/info/avatar.ts
index 6b4afa1..870908d 100644
--- a/src/commands/info/avatar.ts
+++ b/src/commands/info/avatar.ts
@@ -1,5 +1,5 @@
import { BushCommand, type ArgType, type BushMessage, type BushSlashMessage } from '#lib';
-import { ApplicationCommandOptionType, Embed, GuildMember, PermissionFlagsBits } from 'discord.js';
+import { ApplicationCommandOptionType, EmbedBuilder, GuildMember, PermissionFlagsBits } from 'discord.js';
export default class AvatarCommand extends BushCommand {
public constructor() {
@@ -36,7 +36,7 @@ export default class AvatarCommand extends BushCommand {
const guildAvatar = member?.avatarURL(params);
- const embed = new Embed().setTimestamp().setColor(util.colors.default).setTitle(`${user.tag}'s Avatar`);
+ const embed = new EmbedBuilder().setTimestamp().setColor(util.colors.default).setTitle(`${user.tag}'s Avatar`);
guildAvatar
? embed.setImage(guildAvatar).setThumbnail(user.avatarURL(params) ?? defaultAvatar)
: embed.setImage(user.avatarURL(params) ?? defaultAvatar);
diff --git a/src/commands/info/botInfo.ts b/src/commands/info/botInfo.ts
index 4d914e4..1ea54f3 100644
--- a/src/commands/info/botInfo.ts
+++ b/src/commands/info/botInfo.ts
@@ -1,6 +1,6 @@
import { BushCommand, type BushMessage, type BushSlashMessage } from '#lib';
import assert from 'assert';
-import { Embed, PermissionFlagsBits, version as discordJSVersion } from 'discord.js';
+import { EmbedBuilder, PermissionFlagsBits, version as discordJSVersion } from 'discord.js';
import * as os from 'os';
const { default: prettyBytes } = await import('pretty-bytes');
assert(prettyBytes);
@@ -39,7 +39,7 @@ export default class BotInfoCommand extends BushCommand {
const currentCommit = (await util.shell('git rev-parse HEAD')).stdout.replace('\n', '');
let repoUrl = (await util.shell('git remote get-url origin')).stdout.replace('\n', '');
if (repoUrl.includes('.git')) repoUrl = repoUrl.substring(0, repoUrl.length - 4);
- const embed = new Embed()
+ const embed = new EmbedBuilder()
.setTitle('Bot Info:')
.addFields({ name: '**Uptime**', value: util.humanizeDuration(client.uptime!, 2), inline: true })
.addFields({
diff --git a/src/commands/info/color.ts b/src/commands/info/color.ts
index 49e827d..cc4fcc3 100644
--- a/src/commands/info/color.ts
+++ b/src/commands/info/color.ts
@@ -9,7 +9,7 @@ import {
type BushSlashMessage
} from '#lib';
import assert from 'assert';
-import { ApplicationCommandOptionType, Embed, PermissionFlagsBits, Role } from 'discord.js';
+import { ApplicationCommandOptionType, EmbedBuilder, PermissionFlagsBits, Role } from 'discord.js';
import tinycolor from 'tinycolor2';
assert(tinycolor);
@@ -75,7 +75,7 @@ export default class ColorCommand extends BushCommand {
});
}
- const embed = new Embed()
+ const embed = new EmbedBuilder()
.addFields({ name: '» Hexadecimal', value: color.toHexString() })
.addFields({ name: '» Decimal', value: `${parseInt(color.toHex(), 16)}` })
.addFields({ name: '» HSL', value: this.removePrefixAndParenthesis(color.toHslString()) })
diff --git a/src/commands/info/guildInfo.ts b/src/commands/info/guildInfo.ts
index e026d1c..4049250 100644
--- a/src/commands/info/guildInfo.ts
+++ b/src/commands/info/guildInfo.ts
@@ -1,9 +1,9 @@
import { BushCommand, type ArgType, type BushMessage, type BushSlashMessage, type OptionalArgType } from '#lib';
import assert from 'assert';
-import { GuildDefaultMessageNotifications, GuildExplicitContentFilter } from 'discord-api-types/v9';
+import { GuildDefaultMessageNotifications, GuildExplicitContentFilter } from 'discord-api-types/v10';
import {
ApplicationCommandOptionType,
- Embed,
+ EmbedBuilder,
Guild,
GuildMFALevel,
GuildPremiumTier,
@@ -64,7 +64,7 @@ export default class GuildInfoCommand extends BushCommand {
await guild.fetch();
}
- const guildInfoEmbed = new Embed().setTitle(guild.name).setColor(util.colors.default);
+ const guildInfoEmbed = new EmbedBuilder().setTitle(guild.name).setColor(util.colors.default);
if (guild.icon) guildInfoEmbed.setThumbnail(guild.iconURL({ size: 2048, extension: 'png' }));
await this.generateAboutField(guildInfoEmbed, guild);
@@ -78,7 +78,7 @@ export default class GuildInfoCommand extends BushCommand {
return await message.util.reply({ embeds: [guildInfoEmbed] });
}
- private generateDescription(embed: Embed, guild: Guild | GuildPreview) {
+ private generateDescription(embed: EmbedBuilder, guild: Guild | GuildPreview) {
const description: string[] = [];
const otherEmojis = client.consts.mappings.otherEmojis;
@@ -115,7 +115,7 @@ export default class GuildInfoCommand extends BushCommand {
embed.setDescription(`\u200B${/*zero width space*/ description.join(' ')}`);
}
- private async generateAboutField(embed: Embed, guild: Guild | GuildPreview) {
+ private async generateAboutField(embed: EmbedBuilder, guild: Guild | GuildPreview) {
const guildAbout = [];
if (guild instanceof Guild) {
@@ -158,12 +158,12 @@ export default class GuildInfoCommand extends BushCommand {
embed.addFields({ name: '» About', value: guildAbout.join('\n') });
}
- private generateStatsField(embed: Embed, guild: Guild | GuildPreview) {
+ private generateStatsField(embed: EmbedBuilder, guild: Guild | GuildPreview) {
if (!(guild instanceof Guild)) return;
const guildStats: string[] = [];
- const channelTypes = (['Text', 'Voice', 'News', 'Stage', 'Store', 'Category', 'Thread'] as const).map(
+ const channelTypes = (['Text', 'Voice', 'News', 'Stage', 'Category', 'Thread'] as const).map(
(type) =>
`${client.consts.mappings.otherEmojis[`Channel${type}`]} ${guild.channels.cache
.filter((channel) => channel[`is${type}`]())
@@ -194,7 +194,7 @@ export default class GuildInfoCommand extends BushCommand {
embed.addFields({ name: '» Stats', value: guildStats.join('\n') });
}
- private generateSecurityField(embed: Embed, guild: Guild | GuildPreview) {
+ private generateSecurityField(embed: EmbedBuilder, guild: Guild | GuildPreview) {
if (!(guild instanceof Guild)) return;
const guildSecurity: string[] = [];
diff --git a/src/commands/info/help.ts b/src/commands/info/help.ts
index 04abd18..93979ac 100644
--- a/src/commands/info/help.ts
+++ b/src/commands/info/help.ts
@@ -1,12 +1,12 @@
import { BushCommand, type ArgType, type BushMessage, type BushSlashMessage } from '#lib';
+import { ButtonBuilder } from '@discordjs/builders';
import assert from 'assert';
import {
- ActionRow,
+ ActionRowBuilder,
ApplicationCommandOptionType,
AutocompleteInteraction,
- ButtonComponent,
ButtonStyle,
- Embed,
+ EmbedBuilder,
PermissionFlagsBits
} from 'discord.js';
import Fuse from 'fuse.js';
@@ -68,7 +68,7 @@ export default class HelpCommand extends BushCommand {
: null;
if (!isOwner) args.showHidden = false;
if (!command || command.pseudo) {
- const embed = new Embed().setColor(util.colors.default).setTimestamp();
+ const embed = new EmbedBuilder().setColor(util.colors.default).setTimestamp();
embed.setFooter({ text: `For more information about a command use ${prefix}help <command>` });
for (const [, category] of this.handler.categories) {
const categoryFilter = category.filter((command) => {
@@ -93,7 +93,7 @@ export default class HelpCommand extends BushCommand {
return await message.util.reply({ embeds: [embed], components: row.components.length ? [row] : undefined });
}
- const embed = new Embed()
+ const embed = new EmbedBuilder()
.setColor(util.colors.default)
.setTitle(`${command.id} Command`)
.setDescription(`${command.description ?? '*This command does not have a description.*'}`);
@@ -140,18 +140,18 @@ export default class HelpCommand extends BushCommand {
}
private addLinks(message: BushMessage | BushSlashMessage) {
- const row = new ActionRow();
+ const row = new ActionRowBuilder<ButtonBuilder>();
if (!client.config.isDevelopment && !client.guilds.cache.some((guild) => guild.ownerId === message.author.id)) {
- row.addComponents(new ButtonComponent({ style: ButtonStyle.Link, label: 'Invite Me', url: util.invite }));
+ row.addComponents(new ButtonBuilder({ style: ButtonStyle.Link, label: 'Invite Me', url: util.invite }));
}
if (!client.guilds.cache.get(client.config.supportGuild.id)?.members.cache.has(message.author.id)) {
row.addComponents(
- new ButtonComponent({ style: ButtonStyle.Link, label: 'Support Server', url: client.config.supportGuild.invite })
+ new ButtonBuilder({ style: ButtonStyle.Link, label: 'Support Server', url: client.config.supportGuild.invite })
);
}
if (packageDotJSON?.repository)
- row.addComponents(new ButtonComponent({ style: ButtonStyle.Link, label: 'GitHub', url: packageDotJSON.repository }));
+ row.addComponents(new ButtonBuilder({ style: ButtonStyle.Link, label: 'GitHub', url: packageDotJSON.repository }));
else void message.channel?.send('Error importing package.json, please report this to my developer.');
return row;
diff --git a/src/commands/info/icon.ts b/src/commands/info/icon.ts
index 72e82d8..db390a5 100644
--- a/src/commands/info/icon.ts
+++ b/src/commands/info/icon.ts
@@ -1,6 +1,6 @@
import { BushCommand, type BushMessage, type BushSlashMessage } from '#lib';
import assert from 'assert';
-import { Embed, PermissionFlagsBits } from 'discord.js';
+import { EmbedBuilder, PermissionFlagsBits } from 'discord.js';
export default class IconCommand extends BushCommand {
public constructor() {
@@ -20,7 +20,7 @@ export default class IconCommand extends BushCommand {
public override async exec(message: BushMessage | BushSlashMessage) {
assert(message.inGuild());
- const embed = new Embed()
+ const embed = new EmbedBuilder()
.setTimestamp()
.setColor(util.colors.default)
.setImage(
diff --git a/src/commands/info/links.ts b/src/commands/info/links.ts
index e14195e..1cb6de0 100644
--- a/src/commands/info/links.ts
+++ b/src/commands/info/links.ts
@@ -1,6 +1,6 @@
import { BushCommand, type BushMessage, type BushSlashMessage } from '#lib';
import assert from 'assert';
-import { ActionRow, ButtonComponent, ButtonStyle } from 'discord.js';
+import { ActionRowBuilder, ButtonBuilder, ButtonStyle } from 'discord.js';
import packageDotJSON from '../../../package.json' assert { type: 'json' };
assert(packageDotJSON);
@@ -20,13 +20,13 @@ export default class LinksCommand extends BushCommand {
}
public override async exec(message: BushMessage | BushSlashMessage) {
- const buttonRow = new ActionRow();
+ const buttonRow = new ActionRowBuilder<ButtonBuilder>();
if (!client.config.isDevelopment || message.author.isOwner()) {
- buttonRow.addComponents(new ButtonComponent({ style: ButtonStyle.Link, label: 'Invite Me', url: util.invite }));
+ buttonRow.addComponents(new ButtonBuilder({ style: ButtonStyle.Link, label: 'Invite Me', url: util.invite }));
}
buttonRow.addComponents(
- new ButtonComponent({ style: ButtonStyle.Link, label: 'Support Server', url: client.config.supportGuild.invite }),
- new ButtonComponent({ style: ButtonStyle.Link, label: 'GitHub', url: packageDotJSON.repository })
+ new ButtonBuilder({ style: ButtonStyle.Link, label: 'Support Server', url: client.config.supportGuild.invite }),
+ new ButtonBuilder({ style: ButtonStyle.Link, label: 'GitHub', url: packageDotJSON.repository })
);
return await message.util.reply({ content: 'Here are some useful links:', components: [buttonRow] });
}
diff --git a/src/commands/info/ping.ts b/src/commands/info/ping.ts
index 1b5e45a..04ceedd 100644
--- a/src/commands/info/ping.ts
+++ b/src/commands/info/ping.ts
@@ -1,5 +1,5 @@
import { BushCommand, type BushMessage, type BushSlashMessage } from '#lib';
-import { Embed, PermissionFlagsBits, type Message } from 'discord.js';
+import { EmbedBuilder, PermissionFlagsBits, type Message } from 'discord.js';
export default class PingCommand extends BushCommand {
public constructor() {
@@ -20,7 +20,7 @@ export default class PingCommand extends BushCommand {
const timestamp: number = message.editedTimestamp ? message.editedTimestamp : message.createdTimestamp;
const botLatency = `${'```'}\n ${Math.round(sentMessage.createdTimestamp - timestamp)}ms ${'```'}`;
const apiLatency = `${'```'}\n ${Math.round(message.client.ws.ping)}ms ${'```'}`;
- const embed = new Embed()
+ const embed = new EmbedBuilder()
.setTitle('Pong! 🏓')
.addFields({ name: 'Bot Latency', value: botLatency, inline: true })
.addFields({ name: 'API Latency', value: apiLatency, inline: true })
@@ -39,7 +39,7 @@ export default class PingCommand extends BushCommand {
const timestamp2 = await message.interaction.fetchReply().then((m) => (m as Message).createdTimestamp);
const botLatency = `${'```'}\n ${Math.round(timestamp2 - timestamp1)}ms ${'```'}`;
const apiLatency = `${'```'}\n ${Math.round(client.ws.ping)}ms ${'```'}`;
- const embed = new Embed()
+ const embed = new EmbedBuilder()
.setTitle('Pong! 🏓')
.addFields({ name: 'Bot Latency', value: botLatency, inline: true })
.addFields({ name: 'API Latency', value: apiLatency, inline: true })
diff --git a/src/commands/info/pronouns.ts b/src/commands/info/pronouns.ts
index 3eccd85..043b660 100644
--- a/src/commands/info/pronouns.ts
+++ b/src/commands/info/pronouns.ts
@@ -1,5 +1,5 @@
import { BushCommand, type ArgType, type BushMessage, type BushSlashMessage } from '#lib';
-import { ApplicationCommandOptionType, Embed, PermissionFlagsBits } from 'discord.js';
+import { ApplicationCommandOptionType, EmbedBuilder, PermissionFlagsBits } from 'discord.js';
export default class PronounsCommand extends BushCommand {
public constructor() {
@@ -42,7 +42,7 @@ export default class PronounsCommand extends BushCommand {
} else {
return await message.util.reply({
embeds: [
- new Embed({
+ new EmbedBuilder({
title: `${author ? 'Your' : `${util.discord.escapeMarkdown(user.tag)}'s`} pronouns:`,
description: pronouns,
footer: {
diff --git a/src/commands/info/snowflake.ts b/src/commands/info/snowflake.ts
index d9ca5fc..71ae80d 100644
--- a/src/commands/info/snowflake.ts
+++ b/src/commands/info/snowflake.ts
@@ -1,7 +1,7 @@
import { BushCommand, type ArgType, type BushMessage, type BushSlashMessage } from '#lib';
import {
ApplicationCommandOptionType,
- Embed,
+ EmbedBuilder,
PermissionFlagsBits,
SnowflakeUtil,
type DeconstructedSnowflake,
@@ -37,7 +37,7 @@ export default class SnowflakeCommand extends BushCommand {
public override async exec(message: BushMessage | BushSlashMessage, args: { snowflake: ArgType<'snowflake'> }) {
const snowflake = `${args.snowflake}` as Snowflake;
- const snowflakeEmbed = new Embed().setTitle('Unknown :snowflake:').setColor(util.colors.default);
+ const snowflakeEmbed = new EmbedBuilder().setTitle('Unknown :snowflake:').setColor(util.colors.default);
// Channel
if (client.channels.cache.has(snowflake)) {
@@ -57,7 +57,6 @@ export default class SnowflakeCommand extends BushCommand {
channel.isNews() ||
channel.isText() ||
channel.isVoice() ||
- channel.isStore() ||
channel.isStage() ||
channel.isThread()
) {
diff --git a/src/commands/info/userInfo.ts b/src/commands/info/userInfo.ts
index edf2b6d..0d6c891 100644
--- a/src/commands/info/userInfo.ts
+++ b/src/commands/info/userInfo.ts
@@ -8,13 +8,13 @@ import {
type BushSlashMessage,
type BushUser
} from '#lib';
-import { TeamMemberMembershipState, type APIApplication } from 'discord-api-types/v9';
+import { TeamMemberMembershipState, type APIApplication } from 'discord-api-types/v10';
import {
ActivityType,
ApplicationCommandOptionType,
ApplicationFlagsBitField,
ApplicationFlagsString,
- Embed,
+ EmbedBuilder,
PermissionFlagsBits,
UserFlags
} from 'discord.js';
@@ -65,7 +65,7 @@ export default class UserInfoCommand extends BushCommand {
const emojis = [];
const superUsers = util.getShared('superUsers');
- const userEmbed = new Embed()
+ const userEmbed = new EmbedBuilder()
.setTitle(util.discord.escapeMarkdown(user.tag))
.setThumbnail(user.displayAvatarURL({ size: 2048, extension: 'png' }))
.setTimestamp()
@@ -114,12 +114,14 @@ export default class UserInfoCommand extends BushCommand {
if (emojis)
userEmbed.setDescription(
- `\u200B${emojis.filter((e) => e).join(' ')}${userEmbed.description?.length ? `\n\n${userEmbed.description}` : ''}`
+ `\u200B${emojis.filter((e) => e).join(' ')}${
+ userEmbed.data.description?.length ? `\n\n${userEmbed.data.description}` : ''
+ }`
); // zero width space
return userEmbed;
}
- public static async generateGeneralInfoField(embed: Embed, user: BushUser, title = '» General Information') {
+ public static async generateGeneralInfoField(embed: EmbedBuilder, user: BushUser, title = '» General Information') {
// General Info
const generalInfo = [
`**Mention:** <@${user.id}>`,
@@ -136,7 +138,11 @@ export default class UserInfoCommand extends BushCommand {
embed.addFields({ name: title, value: generalInfo.join('\n') });
}
- public static generateServerInfoField(embed: Embed, member?: BushGuildMember | undefined, title = '» Server Information') {
+ public static generateServerInfoField(
+ embed: EmbedBuilder,
+ member?: BushGuildMember | undefined,
+ title = '» Server Information'
+ ) {
if (!member) return;
// Server User Info
@@ -161,7 +167,7 @@ export default class UserInfoCommand extends BushCommand {
if (serverUserInfo.length) embed.addFields({ name: title, value: serverUserInfo.join('\n') });
}
- public static generatePresenceField(embed: Embed, member?: BushGuildMember | undefined, title = '» Presence') {
+ public static generatePresenceField(embed: EmbedBuilder, member?: BushGuildMember | undefined, title = '» Presence') {
if (!member || !member.presence) return;
if (!member.presence.status && !member.presence.clientStatus && !member.presence.activities) return;
@@ -201,7 +207,7 @@ export default class UserInfoCommand extends BushCommand {
});
}
- public static generateRolesField(embed: Embed, member?: BushGuildMember | undefined) {
+ public static generateRolesField(embed: EmbedBuilder, member?: BushGuildMember | undefined) {
if (!member || member.roles.cache.size <= 1) return;
// roles
@@ -217,7 +223,11 @@ export default class UserInfoCommand extends BushCommand {
});
}
- public static generatePermissionsField(embed: Embed, member: BushGuildMember | undefined, title = '» Important Permissions') {
+ public static generatePermissionsField(
+ embed: EmbedBuilder,
+ member: BushGuildMember | undefined,
+ title = '» Important Permissions'
+ ) {
if (!member) return;
// Important Perms
@@ -235,7 +245,7 @@ export default class UserInfoCommand extends BushCommand {
if (perms.length) embed.addFields({ name: title, value: perms.join(' ') });
}
- public static async generateBotField(embed: Embed, user: BushUser, title = '» Bot Information') {
+ public static async generateBotField(embed: EmbedBuilder, user: BushUser, title = '» Bot Information') {
if (!user.bot) return;
const applicationInfo = (await client.rest.get(`/applications/${user.id}/rpc`).catch(() => null)) as APIApplication | null;