Server Icon Command

This commit is contained in:
Dragon Fire
2021-04-01 17:58:22 -04:00
parent 6013713ee7
commit a1dbf1f34d
2 changed files with 32 additions and 1 deletions
+31
View File
@@ -0,0 +1,31 @@
const Command = require('../../structures/Command');
const { MessageEmbed } = require('discord.js');
module.exports = class ServerIconCommand extends Command {
constructor(client) {
super(client, {
name: 'server-icon',
aliases: ['guild-icon', 's-icon', 'g-icon'],
group: 'info',
memberName: 'server-icon',
description: 'Responds with the server\'s icon.',
guildOnly: true,
clientPermissions: ['EMBED_LINKS']
});
}
async run(msg) {
if (!msg.guild.icon) return msg.reply('This server has no icon.');
const formats = ['png', 'jpg', 'webp'];
const format = msg.guild.icon && msg.guild.icon.startsWith('a_') ? 'gif' : 'png';
if (format === 'gif') formats.push('gif');
const embed = new MessageEmbed()
.setTitle(msg.guild.name)
.setDescription(
formats.map(fmt => embedURL(displayFmts[fmt], msg.guild.iconURL({ format: fmt, size: 2048 }))).join(' | ')
)
.setImage(msg.guild.iconURL({ format, size: 2048 }))
.setColor(0x00AE86);
return msg.embed(embed);
}
};
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "xiao",
"version": "134.5.0",
"version": "134.6.0",
"description": "Your personal server companion.",
"main": "Xiao.js",
"scripts": {