aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/utils/Constants.ts16
-rw-r--r--src/commands/info/userInfo.ts32
2 files changed, 31 insertions, 17 deletions
diff --git a/lib/utils/Constants.ts b/lib/utils/Constants.ts
index c30d01d..dd65e28 100644
--- a/lib/utils/Constants.ts
+++ b/lib/utils/Constants.ts
@@ -352,14 +352,14 @@ export const mappings = deepLock({
HypeSquadOnlineHouse2: '<:hypeSquadBrilliance:848742840649646101>',
HypeSquadOnlineHouse3: '<:hypeSquadBalance:848742877537370133>',
PremiumEarlySupporter: '<:earlySupporter:848741030102171648>',
- TeamPseudoUser: 'TeamPseudoUser',
+ TeamPseudoUser: '`TeamPseudoUser`',
BugHunterLevel2: '<:bugHunterGold:848743283080822794>',
VerifiedBot: '<:verifiedbot1:938928232667947028><:verifiedbot2:938928355707879475>',
VerifiedDeveloper: '<:earlyVerifiedBotDeveloper:848741079875846174>',
CertifiedModerator: '<:discordCertifiedModerator:877224285901582366>',
- BotHTTPInteractions: 'BotHTTPInteractions',
- Spammer: 'Spammer',
- Quarantined: 'Quarantined'
+ BotHTTPInteractions: '`BotHTTPInteractions`',
+ Spammer: '`Spammer`',
+ Quarantined: '`Quarantined`'
},
status: {
@@ -370,7 +370,7 @@ export const mappings = deepLock({
streaming: '<:streaming:848937187479519242>'
},
- maybeNitroDiscrims: ['1111', '2222', '3333', '4444', '5555', '6666', '6969', '7777', '8888', '9999'],
+ commonNitroDiscriminators: ['1111', '2222', '3333', '4444', '5555', '6666', '6969', '7777', '8888', '9999'],
capes: [
/* supporter capes */
@@ -464,7 +464,11 @@ export const mappings = deepLock({
}
} as const);
-export const bots: Record<Snowflake, { applicationId: Snowflake }> = {
+interface BotInfo {
+ applicationId: Snowflake;
+}
+
+export const bots: Record<Snowflake, BotInfo> = {
// MEE6#4876
'159985870458322944': {
applicationId: '159985415099514880'
diff --git a/src/commands/info/userInfo.ts b/src/commands/info/userInfo.ts
index f70896d..86132c7 100644
--- a/src/commands/info/userInfo.ts
+++ b/src/commands/info/userInfo.ts
@@ -4,7 +4,6 @@ import {
bots,
colors,
emojis,
- formatPerms,
mappings,
oxford,
sleep,
@@ -100,14 +99,15 @@ export default class UserInfoCommand extends BotCommand {
});
}
- // Since discord bald I just guess if someone has nitro
+ // discord omits nitro information to bots, this is just guessing
if (
Number(user.discriminator) < 10 ||
- mappings.maybeNitroDiscrims.includes(user.discriminator) ||
- user.displayAvatarURL()?.endsWith('.gif') ||
+ mappings.commonNitroDiscriminators.includes(user.discriminator) ||
+ user.displayAvatarURL()?.endsWith('.gif') || // animated avatars are nitro only
user.flags?.has(UserFlags.Partner) ||
user.flags?.has(UserFlags.Staff) ||
- member?.avatar // server avatar
+ member?.avatar || // per server avatars are nitro only
+ user.banner // banners are nitro only
) {
emojis.push(mappings.otherEmojis.Nitro);
}
@@ -243,14 +243,24 @@ export default class UserInfoCommand extends BotCommand {
if (!member) return;
// Important Perms
- const perms = [];
- if (member?.permissions.has(PermissionFlagsBits.Administrator) || member.guild?.ownerId == member.user.id) {
- perms.push('`Administrator`');
- } else if (member?.permissions.toArray().length) {
- perms.push(formatPerms(member.permissions.toArray().filter((p) => mappings.permissions[p]?.important === true)));
+ const perms = this.getImportantPermissions(member);
+
+ if (perms.length) embed.addFields({ name: title, value: this.getImportantPermissions(member).join(' ') });
+ }
+
+ private static getImportantPermissions(member: GuildMember | undefined) {
+ if (member == null || member.guild == null) return [];
+
+ if (member.permissions.has('Administrator') || member.guild.ownerId === member.user.id) {
+ return ['`Administrator`'];
}
- if (perms.length) embed.addFields({ name: title, value: perms.join(' ') });
+ const important = member.permissions
+ .toArray()
+ .filter((p) => mappings.permissions[p]?.important === true)
+ .map((p) => `\`${mappings.permissions[p].name}\``);
+
+ return important;
}
public static async generateBotField(embed: EmbedBuilder, user: User, title = 'ยป Bot Information') {