1 |
rakinar2 |
577 |
import { User, UserFlags } from "discord.js"; |
2 |
|
|
|
3 |
|
|
const flagmap = new Map<UserFlags, string>([ |
4 |
|
|
[UserFlags.ActiveDeveloper, "User is an active developer"], |
5 |
|
|
[UserFlags.BotHTTPInteractions, "Uses application commands"], |
6 |
|
|
[UserFlags.BugHunterLevel1, "Bug hunter: Level 1"], |
7 |
|
|
[UserFlags.BugHunterLevel2, "Bug hunter: Level 2"], |
8 |
|
|
[UserFlags.CertifiedModerator, "Discord Certified Moderator"], |
9 |
|
|
[UserFlags.Collaborator, "User is a collaborator and has staff permissions"], |
10 |
|
|
[UserFlags.DisablePremium, "Nitro features are forcefully turned off for this account"], |
11 |
|
|
[UserFlags.HasUnreadUrgentMessages, "This user has unread urgent messages from Discord"], |
12 |
|
|
[UserFlags.HypeSquadOnlineHouse1, "Hypesquad Bravery"], |
13 |
|
|
[UserFlags.HypeSquadOnlineHouse2, "Hypesquad Brilliance"], |
14 |
|
|
[UserFlags.HypeSquadOnlineHouse3, "Hypesquad Balance"], |
15 |
|
|
[UserFlags.Hypesquad, "This user is a Hypesquad Events member"], |
16 |
|
|
[UserFlags.MFASMS, "This user has SMS-verification enabled"], |
17 |
|
|
[UserFlags.Partner, "This user owns a Discord-partnered server"], |
18 |
|
|
[UserFlags.PremiumEarlySupporter, "This user is a early supporter"], |
19 |
|
|
[UserFlags.PremiumPromoDismissed, "PremiumPromoDismissed (This flag is not exactly known yet)"], |
20 |
|
|
[UserFlags.Quarantined, "This account has been quarantined due to recent activity (Limited access)"], |
21 |
|
|
[UserFlags.RestrictedCollaborator, "User is a restricted collaborator and has staff permissions."], |
22 |
|
|
[UserFlags.Spammer, "This user has been flagged as a spammer"], |
23 |
|
|
[UserFlags.Staff, "This user is a Discord Employee"], |
24 |
|
|
[UserFlags.TeamPseudoUser, "This account is a Team account."], |
25 |
|
|
[UserFlags.VerifiedBot, "This bot is verified"], |
26 |
|
|
[UserFlags.VerifiedDeveloper, "This user is a verified bot developer"] |
27 |
|
|
]); |
28 |
|
|
|
29 |
|
|
export const flagsToString = (flags: Exclude<User["flags"], null>) => { |
30 |
|
|
const strings = []; |
31 |
|
|
|
32 |
|
|
for (const [flag, description] of flagmap.entries()) { |
33 |
|
|
if (flags.has(flag as any)) { |
34 |
|
|
strings.push(description); |
35 |
|
|
} |
36 |
|
|
} |
37 |
|
|
|
38 |
|
|
return strings; |
39 |
|
|
}; |