/[sudobot]/trunk/src/commands/information/UserLookupCommand.ts
ViewVC logotype

Diff of /trunk/src/commands/information/UserLookupCommand.ts

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 285 by rakin, Mon Jul 29 17:29:22 2024 UTC revision 290 by rakin, Mon Jul 29 17:29:23 2024 UTC
# Line 9  import { emoji } from "../../utils/Emoji Line 9  import { emoji } from "../../utils/Emoji
9  import getUser from "../../utils/getUser";  import getUser from "../../utils/getUser";
10  import { parseUser } from "../../utils/parseInput";  import { parseUser } from "../../utils/parseInput";
11  import BaseCommand from "../../utils/structures/BaseCommand";  import BaseCommand from "../../utils/structures/BaseCommand";
12    import { getUserBadges } from "./ProfileCommand";
13    
14  export default class UserLookupCommand extends BaseCommand {  export default class UserLookupCommand extends BaseCommand {
15      supportsInteractions: boolean = true;      supportsInteractions: boolean = true;
# Line 53  export default class UserLookupCommand e Line 54  export default class UserLookupCommand e
54              }              }
55          });          });
56    
57    
58            if (user.hexAccentColor) {            
59                embed.setColor(user.hexAccentColor);
60            }
61    
62          const fieldsCommon: APIEmbedField[] = [            const fieldsCommon: APIEmbedField[] = [  
63                            
64          ];          ];
# Line 61  export default class UserLookupCommand e Line 67  export default class UserLookupCommand e
67              {              {
68                  name: "Server Member?",                  name: "Server Member?",
69                  value: member ? "Yes" : "No",                  value: member ? "Yes" : "No",
70                    inline: true
71                },
72                {
73                    name: "Bot?",
74                    value: user.bot ? "Yes" : "No",
75                    inline: true
76              },              },
77              {              {
78                  name: "Account created",                  name: "Account created",
79                  value: formatDistanceToNowStrict(user.createdAt, { addSuffix: true }),                  value: user.createdAt.toLocaleString() + " (" + formatDistanceToNowStrict(user.createdAt, { addSuffix: true }) + ")",
80                  inline: true                  inline: true
81              }              }
82          ];          ];
83    
84            embed.setThumbnail(user.displayAvatarURL());
85    
86          if (member) {          if (member) {
87              fields.push({              fields.push({
88                  name: "Joined Server",                  name: "Joined Server",
89                  value: member.joinedAt ? formatDistanceToNowStrict(member.joinedAt, { addSuffix: true }) : "Information not available",                  value: member.joinedAt ? member.joinedAt.toLocaleString() + " (" + formatDistanceToNowStrict(member.joinedAt, { addSuffix: true }) + ")" : "Information not available",
90                  inline: true                  inline: true
91              });              });
92    
93              if (member.premiumSince) {              if (member.premiumSince) {
94                  fields.push({                  fields.push({
95                      name: "Boosted Server",                      name: "Boosted Server",
96                      value: formatDistanceToNowStrict(member.premiumSince, { addSuffix: true }),                      value: member.premiumSince.toLocaleString() + " (" + formatDistanceToNowStrict(member.premiumSince, { addSuffix: true }) + ")",
97                      inline: true                      inline: true
98                  });                  });
99              }              }
# Line 87  export default class UserLookupCommand e Line 101  export default class UserLookupCommand e
101              if (member.communicationDisabledUntil) {              if (member.communicationDisabledUntil) {
102                  fields.push({                  fields.push({
103                      name: "Timed-out Until",                      name: "Timed-out Until",
104                      value: formatDistanceStrict(member.communicationDisabledUntil, new Date()),                      value: member.communicationDisabledUntil.toLocaleString() + " (" + formatDistanceStrict(member.communicationDisabledUntil, new Date()) + ")",
105                      inline: true                      inline: true
106                  });                  });
107              }              }
108    
109              if (member.displayAvatarURL() != user.displayAvatarURL()) {              if (member.displayAvatarURL()) {
110                  embed.setThumbnail(member.displayAvatarURL());                  embed.setThumbnail(member.displayAvatarURL());
111              }              }
112    
113                if (member.nickname) {
114                    fields.push({
115                        name: "Nickname",
116                        value: Util.escapeMarkdown(member.nickname)
117                    });
118                }
119    
120                if (member.displayHexColor) {
121                    fields.push({
122                        name: "Guild Profile Theme Color",
123                        value: member.displayHexColor
124                    });
125                }
126                
127                if (member.displayHexColor && !user.hexAccentColor) {
128                    embed.setColor(member.displayHexColor);
129                }
130    
131                if (member.voice && member.voice.channel) {
132                    fields.push({
133                        name: "Current Voice Channel",
134                        value: member.voice.channel.toString()
135                    });
136                }
137    
138                fields.push({
139                    name: "Completed Membership Screening",
140                    value: member.pending ? "No" : "Yes"
141                });
142    
143                fields.push({
144                    name: "Mention",
145                    value: member.toString()
146                });
147    
148                if (member.roles.highest.id !== member.guild.id) {
149                    fields.push({
150                        name: "Highest Role",
151                        value: member.roles.highest.toString()
152                    });
153                }
154          }          }
155    
156            const badges = getUserBadges(user).join('\n');
157    
158            fields.push({
159                name: "Badges",
160                value: badges.trim() === '' ? '*No badges found*' : badges
161            });
162    
163          fields = [...fields, ...fieldsCommon];          fields = [...fields, ...fieldsCommon];
164          embed.setFields(fields);          embed.setFields(fields);
165            embed.setTimestamp();
166                    
167          await message.reply({          await message.reply({
168              embeds: [              embeds: [

Legend:
Removed from v.285  
changed lines
  Added in v.290

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26