|
|
@ -2,6 +2,7 @@ const Discord = require('discord.js'); |
|
|
|
|
|
|
|
|
|
|
|
const {Tag} = require('../../util/tag'); |
|
|
|
const {Tag} = require('../../util/tag'); |
|
|
|
const {TagFilter} = require('../../util/tagfilter'); |
|
|
|
const {TagFilter} = require('../../util/tagfilter'); |
|
|
|
|
|
|
|
const {Pagination} = require('../../util/pagination'); |
|
|
|
|
|
|
|
|
|
|
|
module.exports = { |
|
|
|
module.exports = { |
|
|
|
name: "avatar", |
|
|
|
name: "avatar", |
|
|
@ -15,21 +16,36 @@ module.exports = { |
|
|
|
}, |
|
|
|
}, |
|
|
|
async execute(message, msg, args, cmd, prefix, mention, client) { |
|
|
|
async execute(message, msg, args, cmd, prefix, mention, client) { |
|
|
|
let member = args.length ? (mention || client.users.cache.get(args[0]) || message.author) : message.author; |
|
|
|
let member = args.length ? (mention || client.users.cache.get(args[0]) || message.author) : message.author; |
|
|
|
|
|
|
|
client.users.fetch(member.id, {force: true}); |
|
|
|
|
|
|
|
if (message.guild) {message.guild.members.fetch(member.id, {force: true});} |
|
|
|
let name = message.guild ? message.guild.members.cache.get(member.id).displayName : member.username; |
|
|
|
let name = message.guild ? message.guild.members.cache.get(member.id).displayName : member.username; |
|
|
|
let options = new TagFilter([ |
|
|
|
let options = new TagFilter([ |
|
|
|
new Tag(['small', 's', 'mini', 'm'], 'small', 'toggle'), |
|
|
|
new Tag(['small', 's', 'mini', 'm'], 'small', 'toggle'), |
|
|
|
new Tag(['verysmall', 'vsmall', '-vs', 'xs'], 'vsmall', 'toggle'), |
|
|
|
new Tag(['verysmall', 'vsmall', '-vs', 'xs'], 'vsmall', 'toggle'), |
|
|
|
new Tag(['g', 'global', 'user', 'u'], 'global', 'toggle'), |
|
|
|
new Tag(['g', 'global', 'user', 'u'], 'global', 'toggle'), |
|
|
|
|
|
|
|
new Tag(['b', 'both'], 'both', 'toggle') |
|
|
|
]).test(args.join(" ")); |
|
|
|
]).test(args.join(" ")); |
|
|
|
|
|
|
|
|
|
|
|
try { |
|
|
|
try { |
|
|
|
let avem = new Discord.MessageEmbed() |
|
|
|
if (options.both && message.guild ? member.displayAvatarURL({size: 2048, dynamic: true, format: 'png'}) !== message.guild.members.cache.get(member.id).displayAvatarURL({size: 2048, dynamic: true, format: 'png'}) : false) { |
|
|
|
.setTitle(`${name.endsWith('s') ? `${name}'` : `${name}'s`} Avatar`) |
|
|
|
const pag = new Pagination(message.channel, [message.guild.members, client.users] |
|
|
|
.setImage(message.guild ? (options.global ? client.users : message.guild.members).cache.get(member.id).displayAvatarURL({size: options.vsmall ? 128 : options.small ? 256 : 2048, dynamic: true, format: "png"}) : member.displayAvatarURL({size: options.vsmall ? 128 : options.small ? 256 : 2048, dynamic: true, format: "png"})) |
|
|
|
.map(source => source.cache.get(member.id).displayAvatarURL({size: options.vsmall ? 128 : options.small ? 256 : 2048, dynamic: true, format: "png"})) |
|
|
|
.setColor('c375f0') |
|
|
|
.map((avatar, index) => new Discord.MessageEmbed() |
|
|
|
.setFooter({text: "Natsuki", iconURL: client.user.displayAvatarURL()}) |
|
|
|
.setTitle(`${name.endsWith('s') ? `${name}'` : `${name}'s`} ${['Server', 'Global'][index]} Avatar`) |
|
|
|
if (!options.vsmall) {avem.setTimestamp();} |
|
|
|
.setImage(avatar) |
|
|
|
return message.channel.send({embeds: [avem]}); |
|
|
|
.setColor('c375f0') |
|
|
|
|
|
|
|
), message, client |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
return await pag.start({user: message.author.id, time: 60000}); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
let avem = new Discord.MessageEmbed() |
|
|
|
|
|
|
|
.setTitle(`${name.endsWith('s') ? `${name}'` : `${name}'s`} Avatar`) |
|
|
|
|
|
|
|
.setImage(message.guild ? (options.global ? client.users : message.guild.members).cache.get(member.id).displayAvatarURL({size: options.vsmall ? 128 : options.small ? 256 : 2048, dynamic: true, format: "png"}) : member.displayAvatarURL({size: options.vsmall ? 128 : options.small ? 256 : 2048, dynamic: true, format: "png"})) |
|
|
|
|
|
|
|
.setColor('c375f0') |
|
|
|
|
|
|
|
.setFooter({text: "Natsuki", iconURL: client.user.displayAvatarURL()}) |
|
|
|
|
|
|
|
if (!options.vsmall) {avem.setTimestamp();} |
|
|
|
|
|
|
|
return message.channel.send({embeds: [avem]}); |
|
|
|
|
|
|
|
} |
|
|
|
} catch (e) {console.error(e); return message.reply("Hmm, there seems to have been an error while I tried to show you that user's avatar.");} |
|
|
|
} catch (e) {console.error(e); return message.reply("Hmm, there seems to have been an error while I tried to show you that user's avatar.");} |
|
|
|
} |
|
|
|
} |
|
|
|
}; |
|
|
|
}; |