discord js user info

Solutions on MaxInterview for discord js user info by the best coders in the world

showing results for - "discord js user info"
Luciano
23 Nov 2017
1if(!args[0]){
2  var user = message.author;
3} else var user = message.mentions.users.first()
4         
5const member = message.guild.member(user);
6
7    const activities = [];
8    for (const activity of user.presence.activities.values()) {
9      switch (activity.type) {
10        case 'PLAYING':
11          activities.push(`Playing **${activity.name}**`);
12          break;
13        case 'LISTENING':
14          if (user.bot) activities.push(`Listening to **${activity.name}**`);
15          else activities.push(`Listening to **${activity.details}** by **${activity.state}**`);
16          break;
17        case 'WATCHING':
18          activities.push(`Watching **${activity.name}**`);
19          break;
20        case 'STREAMING':
21          activities.push(`Streaming **${activity.name}**`);
22          break;
23        case 'CUSTOM_STATUS':
24          customStatus = activity.state;
25          break;
26      }}
27
28
29
30
31
32  const infoEmbed = new Discord.MessageEmbed()
33  .setColor("BLUE")
34  .setTitle(`${user.username}'s Information`)
35  .setDescription(`Info from ${message.guild.name}`)
36  .setThumbnail(user.avatarURL({dynamic: true}))
37  .setFooter('requested')
38  .setTimestamp()
39  .addFields(
40      { 
41          name: "User Info",
42          value: "```Username:"+user.username+"\nDiscriminator: #"+user.discriminator+"\nTag: "+user.tag+"\nServer Nickname: "+member.displayName+"\nIs Bot: "+user.bot+"\nID: "+user.id+" ```",
43          inline: true
44      },
45      {
46          name: `Status`,
47          value: "```"+user.presence.status+"\n"+activities+"```",
48          inline: false
49      },
50      {
51          name: `Member Info`,
52          value: "```Joined Server: "+new Date(user.joinedAt).toLocaleDateString()+"\nJoined Discord: "+new Date(user.createdTimestamp).toLocaleDateString()+"```",
53          inline: true
54      },
55      {
56        name: `Roles`,
57        value: ""+member.roles.cache.map(r => r).join(' | ')+"",
58        inline: true
59      },
60    
61
62  )
63
64  return message.channel.send(infoEmbed)