2019-09-13 20:02:41 +00:00
|
|
|
const client = require("../utils/client.js");
|
|
|
|
|
|
|
|
exports.run = async (message, args) => {
|
|
|
|
if (message.mentions[0] !== undefined) {
|
2020-04-25 04:21:05 +00:00
|
|
|
return message.mentions[0].dynamicAvatarURL(null, 1024);
|
2019-09-13 20:02:41 +00:00
|
|
|
} else if (client.users.get(args[0]) !== undefined) {
|
2020-04-25 04:21:05 +00:00
|
|
|
return client.users.get(args[0]).dynamicAvatarURL(null, 1024);
|
2019-12-09 21:33:06 +00:00
|
|
|
} else if (args.join(" ") !== "") {
|
|
|
|
const userRegex = new RegExp(args.join("|"), "i");
|
|
|
|
const member = message.channel.guild.members.find(element => {
|
|
|
|
return userRegex.test(element.nick) ? userRegex.test(element.nick) : userRegex.test(element.username);
|
|
|
|
});
|
2020-07-23 21:10:24 +00:00
|
|
|
return member ? member.user.dynamicAvatarURL(null, 1024) : message.author.dynamicAvatarURL(null, 1024);
|
2019-09-13 20:02:41 +00:00
|
|
|
} else {
|
2020-07-20 22:10:04 +00:00
|
|
|
return message.author.dynamicAvatarURL(null, 1024);
|
2019-09-13 20:02:41 +00:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
exports.aliases = ["pfp", "ava"];
|
2019-12-02 20:47:22 +00:00
|
|
|
exports.category = 1;
|
|
|
|
exports.help = "Gets a user's avatar";
|
2019-12-05 16:58:46 +00:00
|
|
|
exports.params = "{mention/id}";
|