diff --git a/.idea/workspace.xml b/.idea/workspace.xml
index 0634a8a..8cf679b 100644
--- a/.idea/workspace.xml
+++ b/.idea/workspace.xml
@@ -4,10 +4,9 @@
-
-
-
+
+
@@ -79,7 +78,7 @@
-
+
1640148826800
@@ -102,7 +101,14 @@
1640206937172
-
+
+ 1640214318896
+
+
+
+ 1640214318896
+
+
@@ -125,6 +131,7 @@
-
+
+
\ No newline at end of file
diff --git a/commands/anime/char.js b/commands/anime/char.js
index aad365c..d1d434b 100644
--- a/commands/anime/char.js
+++ b/commands/anime/char.js
@@ -323,14 +323,7 @@ module.exports = {
asr.stop();
}
else {return message.reply("Looks like you didn't find the character you were looking for.");}
- } else {
- await message.channel.send({embeds: [asr.embed]});
- let conf = await ask(message, "Is this the character you meant?", 60000);
- if (!['y', 'yes', 'ye', 'n', 'no'].includes(conf.trim().toLowerCase())) {clearDM(); return dmch.send("You must specify yes or no! Please try again.");}
- conf = ['y', 'yes', 'ye'].includes(conf.trim().toLowerCase());
- if (!conf) {return message.channel.send("Well, I've got nothing, then. If that doesn't match the character you're looking for then I would try again with a more narrow search.");}
- fn = asr.id;
- }
+ } else {fn = asr.id;}
let tu = await UserData.findOne({uid: message.author.id});
let queue = false;
if (!tu || !tu.staff) {
@@ -427,6 +420,61 @@ module.exports = {
}
}
+ if (['nn', 'nicknane', 'altname', 'nick'].includes(args[0].toLowerCase())) {
+ args.shift();
+ if (!args[0]) {
+ let tempchar = await ask(message, "What character would you like to add to add a nickname to?", 60000, false, true);
+ if (!tempchar) {return;}
+ args = tempchar.split(/\s+/g);
+ }
+ let asr = await chs(message, client, args.join(" ").trim().toLowerCase(), -700);
+ let fn;
+ if (asr === 0) {
+ return message.channel.send("That search returned no results! Try again?");
+ } else if (asr instanceof Pagination) {
+ await asr.start({user: message.author.id, startPage: 1, endTime: 60000});
+ await asr.message.react('✅');
+ await message.channel.send("React with :white_check_mark: when you've found the character you want!");
+ let arc;
+ try {arc = await asr.message.awaitReactions({filter: (r) => ['✅', '⏹'].includes(r.emoji.name), max: 1, errors: ['time']});}
+ catch {return message.reply("Looks like you didn't find the character you were looking for.");}
+ collected = arc.first().emoji.name;
+ if (collected === '✅') {
+ fn = client.misc.cache.chars.get(asr.getCurrentPage().title.trim());
+ asr.stop();
+ }
+ else {return message.reply("Looks like you didn't find the character you were looking for.");}
+ } else {fn = asr.id;}
+ let tu = await UserData.findOne({uid: message.author.id});
+ let queue = false;
+ if (!tu || !tu.staff) {
+ message.channel.send("This nickname will be __submitted__ for reviewal.");
+ queue = true;
+ }
+ let ch = await Char.findOne({id: fn});
+ let nn = await ask(message, `What nickname would you like to add to ${ch.name}?`, 60000, false, true);
+ if (!nn) {return;}
+ if (!queue) {
+ ch.nicknames.push(nn);
+ ch.markModified('nicknames');
+ 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 Character Nickname ${queue ? "Submitted" : "Added"}`)
+ .setDescription(`For **${ch.name}** | \`${ch.id}\` from ${client.misc.cache.animeID.get(ch.anime)}`)
+ .addField("Name", nn)
+ .setThumbnail(ch.thumbnail)
+ .setColor('c375f0')
+ .setTimestamp()
+ .setFooter("Natsuki")
+ ], content: queue ? '<@330547934951112705>' : undefined
+ }).catch(() => {})).catch(() => {});
+ return message.channel.send(`Character nickname ${queue ? "submitted" : "added"}.`);
+ }
+
return message.channel.send(`Invalid arg! Syntax: \`${prefix}char \``);
}
};
\ No newline at end of file
diff --git a/commands/anime/charimage.js b/commands/anime/charimage.js
new file mode 100644
index 0000000..4c81bea
--- /dev/null
+++ b/commands/anime/charimage.js
@@ -0,0 +1,105 @@
+const Discord = require('discord.js');
+
+const UserData = require('../../models/user');
+const Char = require('../../models/char');
+
+const ask = require('../../util/ask');
+const chs = require('../../util/anime/charsearch');
+const {Pagination} = require('../../util/pagination');
+
+module.exports = {
+ name: "charimage",
+ aliases: ['ci', 'characterimage', 'charimg'],
+ meta: {
+ category: 'Anime',
+ description: "Add an image to a character",
+ syntax: '`charimage ` or `charimage `',
+ extra: null,
+ },
+ help: new Discord.MessageEmbed()
+ .setTitle("Help -> Character Images")
+ .setDescription("Add an image to a character, or list the characters' images.")
+ .addField("Notice", "If you're not a member of Natsuki staff, this image will be submitted for reviewal.")
+ .addField("Syntax", "`charimage ` or `charimage `"),
+ async execute(message, msg, args, cmd, prefix, mention, client) {
+ let list = false;
+ if (args[0] && ['l', 'list'].includes(args[0].toLowerCase())) {
+ list = true;
+ args.shift();
+ }
+ if (!args[0]) {
+ let tempchar = await ask(message, "What character would you like to add to add an image to?", 60000, false, true);
+ if (!tempchar) {return;}
+ args = tempchar.split(/\s+/g);
+ }
+ let asr = await chs(message, client, args.join(" ").trim().toLowerCase(), -700);
+ let fn;
+ if (asr === 0) {
+ return message.channel.send("That search returned no results! Try again?");
+ } else if (asr instanceof Pagination) {
+ await asr.start({user: message.author.id, startPage: 1, endTime: 60000});
+ await asr.message.react('✅');
+ await message.channel.send("React with :white_check_mark: when you've found the character you want!");
+ let arc;
+ try {arc = await asr.message.awaitReactions({filter: (r) => ['✅', '⏹'].includes(r.emoji.name), max: 1, errors: ['time']});}
+ catch {return message.reply("Looks like you didn't find the character you were looking for.");}
+ collected = arc.first().emoji.name;
+ if (collected === '✅') {
+ fn = client.misc.cache.chars.get(asr.getCurrentPage().title.trim());
+ asr.stop();
+ }
+ else {return message.reply("Looks like you didn't find the character you were looking for.");}
+ } else {fn = asr.id;}
+ let tu = await UserData.findOne({uid: message.author.id});
+ let queue = false;
+ if (!tu || !tu.staff) {
+ message.channel.send("This image will be __submitted__ for reviewal.");
+ queue = true;
+ }
+ 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();
+ if (!args[0]) {
+ let tempchar = message.attachments.size
+ ? message.attachments.first().url
+ : await ask(message, "Please paste the image or a link to the image you'd like to add.", 60000, false, true);
+ if (!tempchar) {return;}
+ args = tempchar.split(/\s+/g);
+ }
+ let img = 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?");}
+ if (!queue) {
+ 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 Image ${queue ? "Submitted" : "Added"}`)
+ .setDescription(`For **${ch.name}** | \`${ch.id}\` from ${client.misc.cache.animeID.get(ch.anime)}`)
+ .setThumbnail(ch.thumbnail)
+ .setImage(img)
+ .setColor('c375f0')
+ .setTimestamp()
+ .setFooter("Natsuki")
+ ], content: queue ? '<@330547934951112705>' : undefined
+ }).catch(() => {})).catch(() => {});
+ return message.channel.send(`Character image ${queue ? "submitted" : "added"}.`);
+ }
+ }
+};
\ No newline at end of file
diff --git a/commands/misc/commands.js b/commands/misc/commands.js
index 8b6d295..cecef8c 100644
--- a/commands/misc/commands.js
+++ b/commands/misc/commands.js
@@ -12,7 +12,7 @@ module.exports = {
help: "Shows a list of all my commands",
async execute(message, msg, args, cmd, prefix, mention, client) {
let categories = [];
- Array.from(client.commands.values()).forEach(c => {console.log(c); if (!categories.includes(c.meta ? c.meta.category : 'Uncategorized')) {categories.push(c.meta ? c.meta.category : 'Uncategorized');}});
+ Array.from(client.commands.values()).forEach(c => {if (!categories.includes(c.meta ? c.meta.category : 'Uncategorized')) {categories.push(c.meta ? c.meta.category : 'Uncategorized');}});
let ce = new Discord.MessageEmbed()
.setTitle("Commands")
.setDescription(`You can use \`${prefix}help\` on any command to get more help on it.`)