aboutsummaryrefslogtreecommitdiff
path: root/src/commands/info
diff options
context:
space:
mode:
authorIRONM00N <64110067+IRONM00N@users.noreply.github.com>2021-12-26 17:16:32 -0500
committerIRONM00N <64110067+IRONM00N@users.noreply.github.com>2021-12-26 17:16:32 -0500
commitfc390ffc300334c396d9d06b0feaf8fbc6ed2814 (patch)
treea6282a74cf99033291ac7bc9de123ae273d528d2 /src/commands/info
parent062435590980b87f5b054418ed88604e26358ae9 (diff)
downloadtanzanite-fc390ffc300334c396d9d06b0feaf8fbc6ed2814.tar.gz
tanzanite-fc390ffc300334c396d9d06b0feaf8fbc6ed2814.tar.bz2
tanzanite-fc390ffc300334c396d9d06b0feaf8fbc6ed2814.zip
documentation, bug fixes etc
Diffstat (limited to 'src/commands/info')
-rw-r--r--src/commands/info/snowflake.ts5
-rw-r--r--src/commands/info/userInfo.ts34
2 files changed, 24 insertions, 15 deletions
diff --git a/src/commands/info/snowflake.ts b/src/commands/info/snowflake.ts
index bd0924f..f2ffaa8 100644
--- a/src/commands/info/snowflake.ts
+++ b/src/commands/info/snowflake.ts
@@ -4,7 +4,6 @@ import {
SnowflakeUtil,
VoiceChannel,
type CategoryChannel,
- type Channel,
type DeconstructedSnowflake,
type DMChannel,
type Guild,
@@ -46,9 +45,9 @@ export default class SnowflakeCommand extends BushCommand {
// Channel
if (client.channels.cache.has(snowflake)) {
- const channel: Channel = client.channels.cache.get(snowflake)!;
+ const channel = client.channels.cache.get(snowflake)!;
const channelInfo = [`**Type:** ${channel.type}`];
- if ((['DM', 'GROUP_DM'] as const).includes(channel.type)) {
+ if (['DM', 'GROUP_DM'].includes(channel.type)) {
const _channel = channel as DMChannel;
channelInfo.push(`**Recipient:** ${util.discord.escapeMarkdown(_channel.recipient.tag)} (${_channel.recipient.id})`);
snowflakeEmbed.setTitle(
diff --git a/src/commands/info/userInfo.ts b/src/commands/info/userInfo.ts
index 2d7fcfb..c62be93 100644
--- a/src/commands/info/userInfo.ts
+++ b/src/commands/info/userInfo.ts
@@ -1,4 +1,11 @@
-import { BushCommand, type BushMessage, type BushSlashMessage, type BushUser } from '#lib';
+import {
+ BushCommand,
+ BushGuild,
+ BushGuildMember,
+ type BushMessage,
+ type BushSlashMessage,
+ type BushUser
+} from '#lib';
import { MessageEmbed, type Snowflake } from 'discord.js';
// TODO: Add bot information
@@ -37,11 +44,17 @@ export default class UserInfoCommand extends BushCommand {
: await client.users.fetch(`${args.user}`).catch(() => undefined);
if (user === undefined) return message.util.reply(`${util.emojis.error} Invalid user.`);
const member = message.guild ? message.guild.members.cache.get(user.id) : undefined;
+ await user.fetch(true); // gets banner info and accent color
+
+ const userEmbed = await UserInfoCommand.makeUserInfoEmbed(user, member, message.guild);
+
+ return await message.util.reply({ embeds: [userEmbed] });
+ }
+
+ public static async makeUserInfoEmbed(user: BushUser, member?: BushGuildMember, guild?: BushGuild | null) {
const emojis = [];
const superUsers = client.cache.global.superUsers;
- await user.fetch(true); // gets banner info and accent color
-
const userEmbed: MessageEmbed = new MessageEmbed()
.setTitle(util.discord.escapeMarkdown(user.tag))
.setThumbnail(user.displayAvatarURL({ size: 2048, format: 'png', dynamic: true }))
@@ -69,7 +82,7 @@ export default class UserInfoCommand extends BushCommand {
emojis.push(client.consts.mappings.otherEmojis.NITRO);
}
- if (message.guild?.ownerId == user.id) emojis.push(client.consts.mappings.otherEmojis.OWNER);
+ if (guild?.ownerId == user.id) emojis.push(client.consts.mappings.otherEmojis.OWNER);
else if (member?.permissions.has('ADMINISTRATOR')) emojis.push(client.consts.mappings.otherEmojis.ADMIN);
if (member?.premiumSinceTimestamp) emojis.push(client.consts.mappings.otherEmojis.BOOSTER);
@@ -92,16 +105,14 @@ export default class UserInfoCommand extends BushCommand {
// Server User Info
const serverUserInfo = [];
if (joinedAt)
- serverUserInfo.push(
- `**${message.guild!.ownerId == user.id ? 'Created Server' : 'Joined'}:** ${joinedAt} (${joinedAtDelta} ago)`
- );
+ serverUserInfo.push(`**${guild!.ownerId == user.id ? 'Created Server' : 'Joined'}:** ${joinedAt} (${joinedAtDelta} ago)`);
if (premiumSince) serverUserInfo.push(`**Boosting Since:** ${premiumSince} (${premiumSinceDelta} ago)`);
if (member?.displayHexColor) serverUserInfo.push(`**Display Color:** ${member.displayHexColor}`);
- if (user.id == '322862723090219008' && message.guild?.id == client.consts.mappings.guilds.bush)
+ if (user.id == '322862723090219008' && guild?.id == client.consts.mappings.guilds.bush)
serverUserInfo.push(`**General Deletions:** 1⅓`);
if (
(['384620942577369088', '496409778822709251'] as const).includes(user.id) &&
- message.guild?.id == client.consts.mappings.guilds.bush
+ guild?.id == client.consts.mappings.guilds.bush
)
serverUserInfo.push(`**General Deletions:** ⅓`);
if (member?.nickname) serverUserInfo.push(`**Nickname:** ${util.discord.escapeMarkdown(member?.nickname)}`);
@@ -154,7 +165,7 @@ export default class UserInfoCommand extends BushCommand {
// Important Perms
const perms = [];
- if (member?.permissions.has('ADMINISTRATOR') || message.guild?.ownerId == user.id) {
+ if (member?.permissions.has('ADMINISTRATOR') || guild?.ownerId == user.id) {
perms.push('`Administrator`');
} else if (member?.permissions.toArray(false).length) {
member.permissions.toArray(false).forEach((permission) => {
@@ -166,7 +177,6 @@ export default class UserInfoCommand extends BushCommand {
if (perms.length) userEmbed.addField('» Important Perms', perms.join(' '));
if (emojis) userEmbed.setDescription(`\u200B${emojis.join(' ')}`); // zero width space
-
- return await message.util.reply({ embeds: [userEmbed] });
+ return userEmbed
}
}