This repository has been archived by the owner on Feb 8, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
userinfo.js
67 lines (63 loc) · 2.68 KB
/
userinfo.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
const Discord = require("discord.js");
module.exports = {
userinfo: (guildmember) => {
var user = guildmember.user;
let avatarurl = user.avatarURL;
let isBot = user.bot;
let createdDate = user.createdAt;
let tag = user.discriminator;
let id = user.id;
let usernameinfo = user.username;
let status = user.presence.status;
let isPlaying = user.presence.game != null;
let gamePlaying;
if(isPlaying)
gamePlaying = user.presence.game.name;
let isStreaming = false;
if(isPlaying)
isStreaming = user.presence.game.streaming;
let streamURL;
if(isStreaming)
streamURL = user.presence.game.url;
let hasSentMessage = guildmember.lastMessage != null;
let lastMessageAt;
if(hasSentMessage)
lastMessageAt = guildmember.lastMessage.createdAt;
let hasNickname = guildmember.displayName != null;
let nickname;
if(hasNickname)
nickname = guildmember.displayName;
let isServerMuted = guildmember.serverMute;
let isServerDeafen = guildmember.serverDeaf;
let isSelfMute = guildmember.selfMute;
let isSelfDeafen = guildmember.selfDeaf;
let joinedAt = guildmember.joinedAt;
let inVoice = guildmember.voiceChannel != null;
let voicechannel;
if(inVoice)
voicechannel = guildmember.voiceChannel;
const embed = new Discord.RichEmbed()
.setAuthor(usernameinfo + "#" + tag + " / " + nickname, avatarurl)
.setColor(0x00AE86)
.setTitle("Stats for user:")
.setDescription("Discord handle: " + usernameinfo + "#" + tag + "\n" +
"Userid: " + id + "\n" +
(isBot ? "User is a bot" : "User is not a bot") +"\n" +
"User created at: " + createdDate + "\n" +
"Current status: " + status + "\n" +
"Self muted: " + (isSelfMute ? "Yes" : "No") + "\n" +
"Self deafen: " + (isSelfDeafen ? "Yes" : "No") + "\n" +
(isPlaying ? "User is playing: " + gamePlaying : "User is not playing") + "\n" +
(isStreaming ? "User is streaming at: " + streamURL : ""))
.setFooter("This information was generated using srbot")
.setThumbnail(avatarurl)
.setTimestamp()
.addField("Stats for this server:",
"Server muted: " + (isServerMuted ? "Yes" : "No") + "\n" +
"Server deafen: " + (isServerDeafen ? "Yes" : "No") + "\n" +
"Joined at: " + joinedAt + "\n" +
(inVoice ? "Currently in voicechannel: " + voicechannel.name : "Currently not in voicechannel") + "\n" +
(hasSentMessage ? "Last message on server: " + lastMessageAt : "Never sent a message on this server") + "(experimental)");
return {embed};
}
}