Updated to be like avatar command
This commit is contained in:
parent
971ce9bfed
commit
a878ea977c
1 changed files with 30 additions and 6 deletions
|
@ -21,12 +21,36 @@ class serverIconCommand extends Command {
|
|||
}
|
||||
|
||||
async exec(message, args) {
|
||||
if (!args.serverid)
|
||||
return message.channel.send('This server icon:', {files: [message.guild.iconURL()]});
|
||||
else if (this.client.guilds.find(guild => guild.id == args.serverid))
|
||||
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?');
|
||||
const serverEmbed = this.client.util.embed()
|
||||
.setColor(message.member.displayHexColor)
|
||||
.setTitle('Server icon');
|
||||
|
||||
|
||||
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});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue