|
|
@ -301,6 +301,11 @@ module.exports = { |
|
|
|
|
|
|
|
|
|
|
|
if (['i', 'im', 'img', 'image'].includes(args[0].toLowerCase())) { |
|
|
|
if (['i', 'im', 'img', 'image'].includes(args[0].toLowerCase())) { |
|
|
|
args.shift(); |
|
|
|
args.shift(); |
|
|
|
|
|
|
|
let list = false; |
|
|
|
|
|
|
|
if (args[0] && ['l', 'list'].includes(args[0].toLowerCase())) { |
|
|
|
|
|
|
|
list = true; |
|
|
|
|
|
|
|
args.shift(); |
|
|
|
|
|
|
|
} |
|
|
|
if (!args[0]) { |
|
|
|
if (!args[0]) { |
|
|
|
let tempchar = await ask(message, "What character would you like to add to add an image to?", 60000, false, true); |
|
|
|
let tempchar = await ask(message, "What character would you like to add to add an image to?", 60000, false, true); |
|
|
|
if (!tempchar) {return;} |
|
|
|
if (!tempchar) {return;} |
|
|
@ -331,7 +336,25 @@ module.exports = { |
|
|
|
queue = true; |
|
|
|
queue = true; |
|
|
|
} |
|
|
|
} |
|
|
|
let ch = await Char.findOne({id: fn}); |
|
|
|
let ch = await Char.findOne({id: fn}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (list) { |
|
|
|
|
|
|
|
let pages = ch.images.map(im => new Discord.MessageEmbed() |
|
|
|
|
|
|
|
.setTitle(ch.name) |
|
|
|
|
|
|
|
.setDescription(`**Name:** ${ch.name}`) |
|
|
|
|
|
|
|
.addField('Other', `**Anime**: ${client.misc.cache.animeID.get(ch.anime)}\n\n**Gender**: ${ch.gender}\n`) |
|
|
|
|
|
|
|
.setColor("c375f0") |
|
|
|
|
|
|
|
.setImage(im) |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
if (pages.length > 1) { |
|
|
|
|
|
|
|
let pag = new Pagination(message.channel, pages, message, client, true); |
|
|
|
|
|
|
|
return await pag.start({user: message.author.id, time: 60000}); |
|
|
|
|
|
|
|
} else {return message.channel.send(pages[0].setTimestamp());} |
|
|
|
|
|
|
|
} else { |
|
|
|
args.shift(); |
|
|
|
args.shift(); |
|
|
|
|
|
|
|
let images = []; |
|
|
|
|
|
|
|
if (message.attachments.size > 1) { |
|
|
|
|
|
|
|
Array.from(message.attachments.keys()).forEach(i => images.push(message.attachments.get(i).url)); |
|
|
|
|
|
|
|
} else { |
|
|
|
if (!args[0]) { |
|
|
|
if (!args[0]) { |
|
|
|
let tempchar = message.attachments.size |
|
|
|
let tempchar = message.attachments.size |
|
|
|
? message.attachments.first().url |
|
|
|
? message.attachments.first().url |
|
|
@ -339,8 +362,13 @@ module.exports = { |
|
|
|
if (!tempchar) {return;} |
|
|
|
if (!tempchar) {return;} |
|
|
|
args = tempchar.split(/\s+/g); |
|
|
|
args = tempchar.split(/\s+/g); |
|
|
|
} |
|
|
|
} |
|
|
|
let img = args.join(" "); |
|
|
|
images.push(args.join(" ")); |
|
|
|
if (!img.match(/^https:\/\/(?:[\w\-].?)+[\/\w\-%()_]+\.(?:png|jpg|jpeg|gif|webp)$/gm)) {return message.channel.send("I don't think that's an image. Try again?");} |
|
|
|
} |
|
|
|
|
|
|
|
let f; |
|
|
|
|
|
|
|
images.forEach(img => {if (!img.match(/^https:\/\/(?:[\w\-].?)+[\/\w\-%()_]+\.(?:png|jpg|jpeg|gif|webp)$/gm)) {f = true; return message.channel.send("I don't think that's an image. Try again?");}}) |
|
|
|
|
|
|
|
if (f) {return;} |
|
|
|
|
|
|
|
if (images.length === 1) { |
|
|
|
|
|
|
|
let img = images[0]; |
|
|
|
if (!queue) { |
|
|
|
if (!queue) { |
|
|
|
ch.images.push(img); |
|
|
|
ch.images.push(img); |
|
|
|
ch.markModified('images'); |
|
|
|
ch.markModified('images'); |
|
|
@ -360,6 +388,28 @@ module.exports = { |
|
|
|
], content: queue ? '<@330547934951112705>' : undefined |
|
|
|
], content: queue ? '<@330547934951112705>' : undefined |
|
|
|
}).catch(() => {})).catch(() => {}); |
|
|
|
}).catch(() => {})).catch(() => {}); |
|
|
|
return message.channel.send(`Character image ${queue ? "submitted" : "added"}.`); |
|
|
|
return message.channel.send(`Character image ${queue ? "submitted" : "added"}.`); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
if (!queue) { |
|
|
|
|
|
|
|
images.forEach(img => ch.images.push(img)); |
|
|
|
|
|
|
|
ch.markModified('images'); |
|
|
|
|
|
|
|
ch.save(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
client.guilds.fetch('762707532417335296').then(g => g.channels.cache.get('817466729293938698').send({ |
|
|
|
|
|
|
|
embeds: [ |
|
|
|
|
|
|
|
new Discord.MessageEmbed() |
|
|
|
|
|
|
|
.setAuthor(message.author.username, message.author.avatarURL()) |
|
|
|
|
|
|
|
.setTitle(`New Images ${queue ? "Submitted" : "Added"}`) |
|
|
|
|
|
|
|
.setDescription(`For **${ch.name}** | \`${ch.id}\` from ${client.misc.cache.animeID.get(ch.anime)}`) |
|
|
|
|
|
|
|
.addField("Images", images.map(img => `${img}\n`).join("")) |
|
|
|
|
|
|
|
.setThumbnail(ch.thumbnail) |
|
|
|
|
|
|
|
.setColor('c375f0') |
|
|
|
|
|
|
|
.setTimestamp() |
|
|
|
|
|
|
|
.setFooter("Natsuki") |
|
|
|
|
|
|
|
], content: queue ? '<@330547934951112705>' : undefined |
|
|
|
|
|
|
|
}).catch(() => {})).catch(() => {}); |
|
|
|
|
|
|
|
return message.channel.send(`Character images ${queue ? "submitted" : "added"}.`); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (['la', 'listani', 'listanime', 'inani', 'inanime', 'ia'].includes(args[0].toLowerCase())) { |
|
|
|
if (['la', 'listani', 'listanime', 'inani', 'inanime', 'ia'].includes(args[0].toLowerCase())) { |
|
|
@ -420,7 +470,7 @@ module.exports = { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (['nn', 'nicknane', 'altname', 'nick'].includes(args[0].toLowerCase())) { |
|
|
|
if (['nn', 'nickname', 'altname', 'nick'].includes(args[0].toLowerCase())) { |
|
|
|
args.shift(); |
|
|
|
args.shift(); |
|
|
|
if (!args[0]) { |
|
|
|
if (!args[0]) { |
|
|
|
let tempchar = await ask(message, "What character would you like to add to add a nickname to?", 60000, false, true); |
|
|
|
let tempchar = await ask(message, "What character would you like to add to add a nickname to?", 60000, false, true); |
|
|
|