-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(avatar): avatar command guildonly property (#1)
* Add new avatar that prints the command users' avatar and roles * Add `guildOnly` property to stop commands from running in direct messages
- Loading branch information
Showing
4 changed files
with
784 additions
and
14 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
const { MessageEmbed } = require('discord.js') | ||
|
||
module.exports = { | ||
name: 'avatar', | ||
description: 'Shows your avatar url', | ||
aliases: ['av'], | ||
args: false, | ||
guildOnly: true, | ||
execute: function (message, args) { | ||
const user = message.author | ||
const name = !user.displayName ? user.username : user.displayName | ||
|
||
const avatarEmbed = new MessageEmbed() | ||
.setURL(user.displayAvatarURL()) | ||
.setTitle(name) | ||
.setThumbnail(user.displayAvatarURL({ dynamic: true, size: 128 })) | ||
|
||
if (message.guild.available) { | ||
avatarEmbed | ||
.addField('Roles', | ||
message.guild.member(user).roles.cache | ||
.mapValues(role => role.name) | ||
.reduce((acc, role) => acc + '\n' + role) | ||
) | ||
} | ||
|
||
message.reply(avatarEmbed) | ||
} | ||
} |
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
Oops, something went wrong.