-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathavatar.js
More file actions
69 lines (69 loc) · 2.03 KB
/
avatar.js
File metadata and controls
69 lines (69 loc) · 2.03 KB
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
68
69
//gets the avatar of either the person calling, or the person that is mentioned
module.exports = function command(bot, info)
{
'use strict';
return {
inline: false,
//the alias can be set by putting what you'd like in that array
alias: ['a'],
//description that shows up in the help menu
description: '[<mention user>]Gets the avatar for a user that is mentioned. If there is no mention, then it will get the avatar of the person who used the command.',
//set the permissions [public, elevated, mod, private]
permissions: 'public',
action: function(details)
{
const getAvatar = function(uid)
{
return 'https://cdn.discordapp.com/avatars/' +uid+'/'+bot.users[uid].avatar+'.jpg';
};
console.log(details.input);
if(details.input === '')
{
bot.sendMessage({
to: details.channelID,
embed: {
title: bot.users[details.userID].username +"'s Avatar",
image: {
url: getAvatar(details.userID)
},
color: parseInt('808080',16)
}
});
}
else if(details.args.length == 2)
{
let uid = info.utility.stripUID(details.args[1]);
if(uid)
{
let link = getAvatar(uid);
if(link.includes('null.jpg'))
{
bot.sendMessage({
to: details.channelID,
message: 'The user has a default avatar.'
});
}
else
{
bot.sendMessage({
to: details.channelID,
embed: {
title: bot.users[uid].username+"'s Avatar",
image: {
url: getAvatar(uid)
}
}
});
}
}
}
else
{
bot.sendMessage({
to: details.channelID,
message: 'Please look at the help menu to see how to properly use the command.'
});
}
}
};
};