Created
August 12, 2022 21:43
-
-
Save apos37/1d90f212b51548bf4844940f425af70d to your computer and use it in GitHub Desktop.
Pylon Bot Avatar Command
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Display any user's avatar | |
*/ | |
commands.raw('avatar', async (message) => { | |
// Get the user id | |
const _mentions = message.mentions; | |
const _msg = message.content.replace('!avatar', '').replaceAll(' ', ''); | |
var _userID = ''; | |
if (_mentions[0]) { | |
_userID = _mentions[0].id; | |
} else if (_msg != '') { | |
_userID = _msg; | |
} else { | |
_userID = message.author.id; | |
} | |
// Get the user | |
const user = await discord.getUser(_userID); | |
// console.log(user); | |
// Get avatar | |
const avatar = user?.getAvatarUrl(); | |
message.reply( | |
new discord.Embed({ | |
title: `${user?.getTag()}'s Avatar`, | |
color: (Math.random() * 0xffffff) | 0, | |
footer: { | |
text: '!avatar', | |
}, | |
}) | |
.setTimestamp(new Date().toISOString()) | |
.setImage({ url: avatar }) | |
); | |
// console.log(_profileName); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment