Updated to be like avatar command

This commit is contained in:
loicbersier 2020-02-24 01:46:30 +01:00
parent 971ce9bfed
commit a878ea977c

View file

@ -21,12 +21,36 @@ class serverIconCommand extends Command {
} }
async exec(message, args) { async exec(message, args) {
if (!args.serverid) const serverEmbed = this.client.util.embed()
return message.channel.send('This server icon:', {files: [message.guild.iconURL()]}); .setColor(message.member.displayHexColor)
else if (this.client.guilds.find(guild => guild.id == args.serverid)) .setTitle('Server icon');
return message.channel.send(`${this.client.guilds.find(guild => guild.id == args.serverid).name}`, {files: [this.client.guilds.find(guild => guild.id == args.serverid).iconURL()]});
else
return message.channel.send('Could not find any guild, am i in the guild you are trying to get the icon of?'); if (!args.serverid) {
let format = message.guild.iconURL().substr(message.guild.iconURL().length - 3);
if (format == 'gif') {
serverEmbed.setAuthor(message.guild.name);
serverEmbed.setDescription(`[gif](${message.guild.iconURL({ format: 'gif', size: 2048 })})`);
serverEmbed.setImage(message.guild.iconURL({ format: 'gif', size: 2048 }));
} else {
serverEmbed.setAuthor(message.guild.name);
serverEmbed.setDescription(`[png](${message.guild.iconURL({ format: 'png', size: 2048 })}) | [jpeg](${message.guild.iconURL({ format: 'jpg', size: 2048 })}) | [webp](${message.guild.iconURL({ format: 'webp', size: 2048 })})`);
serverEmbed.setImage(message.guild.iconURL({ format: 'png', size: 2048 }));
}
return message.channel.send({embed: serverEmbed});
} else {
let format = this.client.guilds.find(guild => guild.id == args.serverid).iconURL().substr(this.client.guilds.find(guild => guild.id == args.serverid).iconURL().length - 3);
if (format == 'gif') {
serverEmbed.setAuthor(this.client.guilds.find(guild => guild.id == args.serverid).name);
serverEmbed.setDescription(`[gif](${this.client.guilds.find(guild => guild.id == args.serverid).iconURL({ format: 'gif', size: 2048 })})`);
serverEmbed.setImage(this.client.guilds.find(guild => guild.id == args.serverid).iconURL({ format: 'gif', size: 2048 }));
} else {
serverEmbed.setAuthor(this.client.guilds.find(guild => guild.id == args.serverid).name);
serverEmbed.setDescription(`[png](${this.client.guilds.find(guild => guild.id == args.serverid).iconURL({ format: 'png', size: 2048 })}) | [jpeg](${this.client.guilds.find(guild => guild.id == args.serverid).iconURL({ format: 'jpg', size: 2048 })}) | [webp](${this.client.guilds.find(guild => guild.id == args.serverid).iconURL({ format: 'webp', size: 2048 })})`);
serverEmbed.setImage(this.client.guilds.find(guild => guild.id == args.serverid).iconURL({ format: 'png', size: 2048 }));
}
return message.channel.send({embed: serverEmbed});
}
} }
} }