aboutsummaryrefslogtreecommitdiff
path: root/src/commands/info
diff options
context:
space:
mode:
authorIRONM00N <64110067+IRONM00N@users.noreply.github.com>2022-01-31 19:20:39 -0500
committerIRONM00N <64110067+IRONM00N@users.noreply.github.com>2022-01-31 19:20:39 -0500
commitbab76f38a17c62f8c1477172fe1bc9428efb3843 (patch)
tree9aee5ed7b54e74735ff417820427c9d2efa984f4 /src/commands/info
parent78ab3362a52578d0bcada903732f147747c609df (diff)
downloadtanzanite-bab76f38a17c62f8c1477172fe1bc9428efb3843.tar.gz
tanzanite-bab76f38a17c62f8c1477172fe1bc9428efb3843.tar.bz2
tanzanite-bab76f38a17c62f8c1477172fe1bc9428efb3843.zip
fixes, and breaking changes
Diffstat (limited to 'src/commands/info')
-rw-r--r--src/commands/info/avatar.ts6
-rw-r--r--src/commands/info/botInfo.ts4
-rw-r--r--src/commands/info/color.ts5
-rw-r--r--src/commands/info/guildInfo.ts14
-rw-r--r--src/commands/info/help.ts4
-rw-r--r--src/commands/info/icon.ts6
-rw-r--r--src/commands/info/ping.ts4
-rw-r--r--src/commands/info/pronouns.ts4
-rw-r--r--src/commands/info/snowflake.ts4
-rw-r--r--src/commands/info/userInfo.ts18
10 files changed, 35 insertions, 34 deletions
diff --git a/src/commands/info/avatar.ts b/src/commands/info/avatar.ts
index 1d1a27b..0ea9179 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, Permissions } from 'discord.js';
+import { ApplicationCommandOptionType, Embed, GuildMember, PermissionFlagsBits } from 'discord.js';
export default class AvatarCommand extends BushCommand {
constructor() {
@@ -21,14 +21,14 @@ export default class AvatarCommand extends BushCommand {
slashType: ApplicationCommandOptionType.User
}
],
- clientPermissions: (m) => util.clientSendAndPermCheck(m, [Permissions.FLAGS.EMBED_LINKS], true),
+ clientPermissions: (m) => util.clientSendAndPermCheck(m, [PermissionFlagsBits.EmbedLinks], true),
userPermissions: [],
slash: true
});
}
override async exec(message: BushMessage | BushSlashMessage, args: { user: ArgType<'member'> | ArgType<'globalUser'> }) {
- const params: { size: 2048; format: 'png'; dynamic: true } = { size: 2048, format: 'png', dynamic: true };
+ const params: { size: 2048; extension: 'png'; dynamic: true } = { size: 2048, extension: 'png', dynamic: true };
const defaultAvatar = `https://cdn.discordapp.com/embed/avatars/${Math.ceil(Math.random() * 6) - 1}.png`;
const member = (args.user ?? message.member) instanceof GuildMember ? args.user ?? message.member : undefined;
diff --git a/src/commands/info/botInfo.ts b/src/commands/info/botInfo.ts
index d899a95..d23f5b1 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, Permissions, version as discordJSVersion } from 'discord.js';
+import { Embed, PermissionFlagsBits, version as discordJSVersion } from 'discord.js';
import * as os from 'os';
const { default: prettyBytes } = await import('pretty-bytes');
assert(prettyBytes);
@@ -15,7 +15,7 @@ export default class BotInfoCommand extends BushCommand {
usage: ['bot-info'],
examples: ['bot-info'],
slash: true,
- clientPermissions: (m) => util.clientSendAndPermCheck(m, [Permissions.FLAGS.EMBED_LINKS], true),
+ clientPermissions: (m) => util.clientSendAndPermCheck(m, [PermissionFlagsBits.EmbedLinks], true),
userPermissions: []
});
}
diff --git a/src/commands/info/color.ts b/src/commands/info/color.ts
index 0e1be81..6aad1fe 100644
--- a/src/commands/info/color.ts
+++ b/src/commands/info/color.ts
@@ -9,8 +9,9 @@ import {
type BushSlashMessage
} from '#lib';
import assert from 'assert';
-import { ApplicationCommandOptionType, Embed, Permissions, Role } from 'discord.js';
+import { ApplicationCommandOptionType, Embed, PermissionFlagsBits, Role } from 'discord.js';
import tinycolor from 'tinycolor2';
+
assert(tinycolor);
const isValidTinyColor: BushArgumentTypeCaster<string | null> = (_message, phase) => {
@@ -40,7 +41,7 @@ export default class ColorCommand extends BushCommand {
}
],
channel: 'guild',
- clientPermissions: (m) => util.clientSendAndPermCheck(m, [Permissions.FLAGS.EMBED_LINKS], true),
+ clientPermissions: (m) => util.clientSendAndPermCheck(m, [PermissionFlagsBits.EmbedLinks], true),
userPermissions: []
});
}
diff --git a/src/commands/info/guildInfo.ts b/src/commands/info/guildInfo.ts
index 03f6441..0aabb70 100644
--- a/src/commands/info/guildInfo.ts
+++ b/src/commands/info/guildInfo.ts
@@ -8,7 +8,7 @@ import {
GuildMFALevel,
GuildPremiumTier,
GuildVerificationLevel,
- Permissions,
+ PermissionFlagsBits,
type BaseGuildVoiceChannel,
type GuildPreview,
type Snowflake,
@@ -36,7 +36,7 @@ export default class GuildInfoCommand extends BushCommand {
}
],
slash: true,
- clientPermissions: (m) => util.clientSendAndPermCheck(m, [Permissions.FLAGS.EMBED_LINKS], true),
+ clientPermissions: (m) => util.clientSendAndPermCheck(m, [PermissionFlagsBits.EmbedLinks], true),
userPermissions: []
});
}
@@ -98,14 +98,14 @@ export default class GuildInfoCommand extends BushCommand {
);
if (guild.premiumSubscriptionCount)
guildAbout.push(`**Boosts:** Level ${guild.premiumTier} with ${guild.premiumSubscriptionCount ?? 0} boosts`);
- if (guild.me?.permissions.has(Permissions.FLAGS.MANAGE_GUILD) && guild.vanityURLCode) {
+ if (guild.me?.permissions.has(PermissionFlagsBits.ManageGuild) && guild.vanityURLCode) {
const vanityInfo: Vanity = await guild.fetchVanityData();
guildAbout.push(`**Vanity URL:** discord.gg/${vanityInfo.code}`, `**Vanity Uses:** ${vanityInfo.uses?.toLocaleString()}`);
}
- if (guild.icon) guildAbout.push(`**Icon:** [link](${guild.iconURL({ size: 4096, format: 'png' })})`);
- if (guild.banner) guildAbout.push(`**Banner:** [link](${guild.bannerURL({ size: 4096, format: 'png' })})`);
- if (guild.splash) guildAbout.push(`**Splash:** [link](${guild.splashURL({ size: 4096, format: 'png' })})`);
+ if (guild.icon) guildAbout.push(`**Icon:** [link](${guild.iconURL({ size: 4096, extension: 'png' })})`);
+ if (guild.banner) guildAbout.push(`**Banner:** [link](${guild.bannerURL({ size: 4096, extension: 'png' })})`);
+ if (guild.splash) guildAbout.push(`**Splash:** [link](${guild.splashURL({ size: 4096, extension: 'png' })})`);
const EmojiTierMap = {
[GuildPremiumTier.Tier3]: 500,
@@ -173,7 +173,7 @@ export default class GuildInfoCommand extends BushCommand {
.setColor(util.colors.default)
.addField({ name: '» About', value: guildAbout.join('\n') });
if (guildStats.length) guildInfoEmbed.addField({ name: '» Stats', value: guildStats.join('\n') });
- const guildIcon = guild.iconURL({ size: 2048, format: 'png' });
+ const guildIcon = guild.iconURL({ size: 2048, extension: 'png' });
if (guildIcon) {
guildInfoEmbed.setThumbnail(guildIcon);
}
diff --git a/src/commands/info/help.ts b/src/commands/info/help.ts
index 67f99d1..e31153b 100644
--- a/src/commands/info/help.ts
+++ b/src/commands/info/help.ts
@@ -7,7 +7,7 @@ import {
ButtonComponent,
ButtonStyle,
Embed,
- Permissions
+ PermissionFlagsBits
} from 'discord.js';
import Fuse from 'fuse.js';
import packageDotJSON from '../../../package.json' assert { type: 'json' };
@@ -47,7 +47,7 @@ export default class HelpCommand extends BushCommand {
}
],
slash: true,
- clientPermissions: (m) => util.clientSendAndPermCheck(m, [Permissions.FLAGS.EMBED_LINKS], true),
+ clientPermissions: (m) => util.clientSendAndPermCheck(m, [PermissionFlagsBits.EmbedLinks], true),
userPermissions: []
});
}
diff --git a/src/commands/info/icon.ts b/src/commands/info/icon.ts
index ed9ab0f..b40b814 100644
--- a/src/commands/info/icon.ts
+++ b/src/commands/info/icon.ts
@@ -1,5 +1,5 @@
import { BushCommand, type BushMessage, type BushSlashMessage } from '#lib';
-import { Embed, Permissions } from 'discord.js';
+import { Embed, PermissionFlagsBits } from 'discord.js';
export default class IconCommand extends BushCommand {
constructor() {
@@ -9,7 +9,7 @@ export default class IconCommand extends BushCommand {
description: "A command to get the server's icon",
usage: ['icon'],
examples: ['icon'],
- clientPermissions: (m) => util.clientSendAndPermCheck(m, [Permissions.FLAGS.EMBED_LINKS], true),
+ clientPermissions: (m) => util.clientSendAndPermCheck(m, [PermissionFlagsBits.EmbedLinks], true),
userPermissions: [],
channel: 'guild',
slash: true
@@ -23,7 +23,7 @@ export default class IconCommand extends BushCommand {
.setImage(
message.guild!.iconURL({
size: 2048,
- format: 'png'
+ extension: 'png'
})!
)
.setTitle(util.discord.escapeMarkdown(message.guild!.name));
diff --git a/src/commands/info/ping.ts b/src/commands/info/ping.ts
index 35e9748..c767361 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, Permissions, type Message } from 'discord.js';
+import { Embed, PermissionFlagsBits, type Message } from 'discord.js';
export default class PingCommand extends BushCommand {
public constructor() {
@@ -10,7 +10,7 @@ export default class PingCommand extends BushCommand {
usage: ['ping'],
examples: ['ping'],
slash: true,
- clientPermissions: (m) => util.clientSendAndPermCheck(m, [Permissions.FLAGS.EMBED_LINKS], true),
+ clientPermissions: (m) => util.clientSendAndPermCheck(m, [PermissionFlagsBits.EmbedLinks], true),
userPermissions: []
});
}
diff --git a/src/commands/info/pronouns.ts b/src/commands/info/pronouns.ts
index 9ba2a2a..652881b 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, Permissions } from 'discord.js';
+import { ApplicationCommandOptionType, Embed, PermissionFlagsBits } from 'discord.js';
export default class PronounsCommand extends BushCommand {
public constructor() {
@@ -20,7 +20,7 @@ export default class PronounsCommand extends BushCommand {
slashType: ApplicationCommandOptionType.User
}
],
- clientPermissions: (m) => util.clientSendAndPermCheck(m, [Permissions.FLAGS.EMBED_LINKS], true),
+ clientPermissions: (m) => util.clientSendAndPermCheck(m, [PermissionFlagsBits.EmbedLinks], true),
userPermissions: [],
slash: true
});
diff --git a/src/commands/info/snowflake.ts b/src/commands/info/snowflake.ts
index 7efd3ce..3295960 100644
--- a/src/commands/info/snowflake.ts
+++ b/src/commands/info/snowflake.ts
@@ -2,7 +2,7 @@ import { BushCommand, type ArgType, type BushMessage, type BushSlashMessage } fr
import {
ApplicationCommandOptionType,
Embed,
- Permissions,
+ PermissionFlagsBits,
SnowflakeUtil,
type DeconstructedSnowflake,
type Guild,
@@ -29,7 +29,7 @@ export default class SnowflakeCommand extends BushCommand {
slashType: ApplicationCommandOptionType.String
}
],
- clientPermissions: (m) => util.clientSendAndPermCheck(m, [Permissions.FLAGS.EMBED_LINKS], true),
+ clientPermissions: (m) => util.clientSendAndPermCheck(m, [PermissionFlagsBits.EmbedLinks], true),
userPermissions: [],
slash: true
});
diff --git a/src/commands/info/userInfo.ts b/src/commands/info/userInfo.ts
index 2f35770..66eabe1 100644
--- a/src/commands/info/userInfo.ts
+++ b/src/commands/info/userInfo.ts
@@ -7,7 +7,7 @@ import {
type BushSlashMessage,
type BushUser
} from '#lib';
-import { ActivityType, ApplicationCommandOptionType, Embed, Permissions, UserFlags } from 'discord.js';
+import { ActivityType, ApplicationCommandOptionType, Embed, PermissionFlagsBits, UserFlags } from 'discord.js';
// TODO: Add bot information
export default class UserInfoCommand extends BushCommand {
@@ -31,7 +31,7 @@ export default class UserInfoCommand extends BushCommand {
}
],
slash: true,
- clientPermissions: (m) => util.clientSendAndPermCheck(m, [Permissions.FLAGS.EMBED_LINKS], true),
+ clientPermissions: (m) => util.clientSendAndPermCheck(m, [PermissionFlagsBits.EmbedLinks], true),
userPermissions: []
});
}
@@ -58,7 +58,7 @@ export default class UserInfoCommand extends BushCommand {
const userEmbed: Embed = new Embed()
.setTitle(util.discord.escapeMarkdown(user.tag))
- .setThumbnail(user.displayAvatarURL({ size: 2048, format: 'png' }))
+ .setThumbnail(user.displayAvatarURL({ size: 2048, extension: 'png' }))
.setTimestamp();
// Flags
@@ -78,15 +78,15 @@ export default class UserInfoCommand extends BushCommand {
Number(user.discriminator) < 10 ||
client.consts.mappings.maybeNitroDiscrims.includes(user.discriminator) ||
user.displayAvatarURL()?.endsWith('.gif') ||
- user.flags?.has(UserFlags.FLAGS.PARTNER) ||
- user.flags?.has(UserFlags.FLAGS.STAFF) ||
+ user.flags?.has(UserFlags.Partner) ||
+ user.flags?.has(UserFlags.Staff) ||
member?.avatar // server avatar
) {
emojis.push(client.consts.mappings.otherEmojis.Nitro);
}
if (guild?.ownerId == user.id) emojis.push(client.consts.mappings.otherEmojis.Owner);
- else if (member?.permissions.has(Permissions.FLAGS.ADMINISTRATOR)) emojis.push(client.consts.mappings.otherEmojis.Admin);
+ else if (member?.permissions.has(PermissionFlagsBits.Administrator)) emojis.push(client.consts.mappings.otherEmojis.Admin);
if (member?.premiumSinceTimestamp) emojis.push(client.consts.mappings.otherEmojis.Booster);
const createdAt = util.timestamp(user.createdAt),
@@ -99,7 +99,7 @@ export default class UserInfoCommand extends BushCommand {
// General Info
const generalInfo = [`**Mention:** <@${user.id}>`, `**ID:** ${user.id}`, `**Created:** ${createdAt} (${createdAtDelta} ago)`];
if (user.accentColor !== null) generalInfo.push(`**Accent Color:** ${user.hexAccentColor}`);
- if (user.banner) generalInfo.push(`**Banner:** [link](${user.bannerURL({ format: 'png', size: 4096 })})`);
+ if (user.banner) generalInfo.push(`**Banner:** [link](${user.bannerURL({ extension: 'png', size: 4096 })})`);
const pronouns = await Promise.race([util.getPronounsOf(user), util.sleep(2)]);
if (pronouns && typeof pronouns === 'string') generalInfo.push(`**Pronouns:** ${pronouns}`);
@@ -173,7 +173,7 @@ export default class UserInfoCommand extends BushCommand {
// Important Perms
const perms = [];
- if (member?.permissions.has(Permissions.FLAGS.ADMINISTRATOR) || guild?.ownerId == user.id) {
+ if (member?.permissions.has(PermissionFlagsBits.Administrator) || guild?.ownerId == user.id) {
perms.push('`Administrator`');
} else if (member?.permissions.toArray().length) {
member.permissions.toArray().forEach((permission) => {
@@ -184,7 +184,7 @@ export default class UserInfoCommand extends BushCommand {
}
if (perms.length) userEmbed.addField({ name: '» Important Perms', value: perms.join(' ') });
- if (emojis) userEmbed.setDescription(`\u200B${emojis.join(' ')}`); // zero width space
+ if (emojis) userEmbed.setDescription(`\u200B${emojis.filter((e) => e).join(' ')}`); // zero width space
return userEmbed;
}
}