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

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

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

revision 51 by rakin, Mon Jul 29 17:28:23 2024 UTC revision 64 by rakin, Mon Jul 29 17:28:27 2024 UTC
# Line 55  export default class ProfileCommand exte Line 55  export default class ProfileCommand exte
55              }              }
56          }          }
57    
58            const status = (s: 'idle' | 'online' | 'dnd' | 'invisible' | null | undefined): string => {
59                if (s === 'idle')
60                    return 'Idle';
61                else if (s === 'dnd')
62                    return 'Do not disturb';
63                else if (s === 'online')
64                    return 'Online';
65                else if (s === undefined || s === null || s === 'invisible')
66                    return 'Offline/Invisible';
67    
68                return s;
69            };    
70    
71            const statusText = '' + ((user?.presence?.clientStatus?.desktop ? 'Desktop (' + status(user?.presence?.clientStatus?.desktop) + ')\n' : '') + (user?.presence?.clientStatus?.web ? 'Web (' + status(user?.presence?.clientStatus?.web) + ')\n' : '') + (user?.presence?.clientStatus?.mobile ? 'Mobile (' + status(user?.presence?.clientStatus?.mobile) + ')' : ''));
72            const state = user?.presence?.activities.find(a => a.type === 'CUSTOM')?.state;
73    
74          await msg.reply({          await msg.reply({
75              embeds: [              embeds: [
76                  new MessageEmbed()                  new MessageEmbed()
77                  .setColor(user!.user!.hexAccentColor ? user!.user!.hexAccentColor! : '#007bff')                  .setColor(user!.user!.hexAccentColor ? user!.user!.hexAccentColor! : '#007bff')
78                  .setAuthor({                  .setAuthor({
79                      name: user?.user.tag!,                      name: user?.user.tag!,
80                      iconURL: user!.displayAvatarURL()                      iconURL: user!.user.displayAvatarURL()
81                  })                  })
82                  .setImage(user!.displayAvatarURL({                  .setImage(user!.displayAvatarURL({
83                      size: 4096                      size: 4096
# Line 83  export default class ProfileCommand exte Line 99  export default class ProfileCommand exte
99                          value: `${user!.user.createdAt.toLocaleDateString('en-US')} (${timeSince(user!.user.createdTimestamp)})`                          value: `${user!.user.createdAt.toLocaleDateString('en-US')} (${timeSince(user!.user.createdTimestamp)})`
100                      },                      },
101                      {                      {
102                            name: "Joined at",
103                            value: `${user!.joinedAt!.toLocaleDateString('en-US')} (${timeSince(user!.joinedTimestamp!)})`
104                        },
105                        {
106                            name: 'Active Devices',
107                            value: `${statusText === '' ? 'Offline/Invisible' : statusText}`
108                        },
109                        {
110                            name: 'Custom Status',
111                            value: `${state ?? '*No custom status set*'}`
112                        },
113                        {
114                          name: 'Roles',                          name: 'Roles',
115                          value: user?.roles.cache.filter(role => role.id !== msg.guild!.id).reduce((acc, value) => `${acc} ${roleMention(value.id)}`, '')!.trim()!                          value: user?.roles.cache.filter(role => role.id !== msg.guild!.id).reduce((acc, value) => `${acc} ${roleMention(value.id)}`, '')!.trim()!
116                      }                      }

Legend:
Removed from v.51  
changed lines
  Added in v.64

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26