discord_bot/commands/info/pfp.js
SileNce5k cafcc007c1
All checks were successful
CI / CI (push) Successful in 22s
Don't specify global pfp when there's only one
2026-01-29 22:37:59 +01:00

26 lines
No EOL
881 B
JavaScript

const parseMention = require("../../util/parseMention.js")
module.exports = {
name: 'pfp',
description: 'Returns profile picture',
moreHelp: ["Returns your profile picture if no arguments are provided",
"Argument can be username, nickname, userid, and mention",
"If the user has a pfp for the current guild, it will be returned as well"],
execute({message, args}) {
let info;
if (!args[0]) {
info = message.author.id;
} else {
info = parseMention(args[0], message.guild);
}
let user = message.guild.members.cache.get(info);
let guildPfp = user.avatarURL({format: 'png', dynamic: true, size: 4096});
let globalPfp = user.user.avatarURL({format: 'png', dynamic: true, size: 4096});
let sendText = `${globalPfp}`;
if(guildPfp != null){
sendText = `Global pfp${sendText}\nGuild pfp:\n${guildPfp}`;
}
message.channel.send(sendText)
}
};