accept submitted characters

master
Kit Kasune 3 years ago
parent bc1abc1924
commit a5e62cceb1
  1. 29
      commands/anime/char.js

@ -367,7 +367,7 @@ module.exports = {
if (['reject'].includes(args[0].trim().toLowerCase())) { if (['reject'].includes(args[0].trim().toLowerCase())) {
let tu = await UserData.findOne({uid: message.author.id}); let tu = await UserData.findOne({uid: message.author.id});
if (!tu || !tu.staff) {await message.channel.send("Since you aren't a Natsuki Staff member, you can't reject character submissions!");} if (!tu || !tu.staff) {await message.channel.send("Since you aren't a Natsuki Staff member, you can't reject character submissions!");}
let tr = await CharData.findOne({id: args[1].toLowerCase()}); let tr = await Char.findOne({id: args[1].toLowerCase()});
if (!tr) {return message.reply("That character submission doesn't seem to exist!");} if (!tr) {return message.reply("That character submission doesn't seem to exist!");}
if (tr.queued !== true) {return message.reply("That character was already accepted, so you can't reject it.");} if (tr.queued !== true) {return message.reply("That character was already accepted, so you can't reject it.");}
return await CharData.deleteOne({id: args[1].toLowerCase()}) return await CharData.deleteOne({id: args[1].toLowerCase()})
@ -375,6 +375,33 @@ module.exports = {
.catch(() => {return message.reply("It seems that submission wasn't deleted for some reason. \*insert head scratching*");}); .catch(() => {return message.reply("It seems that submission wasn't deleted for some reason. \*insert head scratching*");});
} }
if (['accept', 'approve'].includes(args[0].toLowerCase())) {
let tu = await UserData.findOne({uid: message.author.id});
if (!tu || !tu.staff) {await message.channel.send("Since you aren't a Natsuki Staff member, you can't accept character submissions!");}
let tr = await Char.findOne({id: args[1].toLowerCase()});
if (!tr) {return message.reply("That character submission doesn't seem to exist!");}
if (tr.queued !== true) {return message.reply("That character was already accepted, so you can't accept it again...");}
tr.queued = false;
return await tr.save()
.then(() => {
client.misc.cache.chars.set(tr.name.normalize("NFD").replace(/[\u0300-\u036f]/g, ""), tr.id);
tr.nicknames.forEach(nn => client.misc.cache.chars.set(nn.normalize("NFD").replace(/[\u0300-\u036f]/g, ""), tr.id));
client.misc.cache.charsID.set(tr.id, tr.name.normalize("NFD").replace(/[\u0300-\u036f]/g, ""));
client.misc.cache.charsNum++;
client.guilds.cache.get('762707532417335296').channels.cache.get('932177797705781308').send({embeds: [new Discord.MessageEmbed()
.setTitle(`Character Accepted -> ${tr.name}`)
.setAuthor({name: 'Character Approved', iconURL: message.author.avatarURL()})
.setThumbnail(tr.thumbnail)
.setDescription(`${tr.name} has been approved, and is now available to all Natsuki users.`)
.setColor('c375f0')
.setFooter({text: "Natsuki"})
.setTimestamp()
]}).catch(() => {});
return message.channel.send("I've accepted that submission.");
})
.catch(() => {return message.reply("It seems that submission wasn't accepted for some reason. \*insert head scratching*");});
}
if (['r', 'rand', 'random', 'any'].includes(args[0].toLowerCase())) { if (['r', 'rand', 'random', 'any'].includes(args[0].toLowerCase())) {
let asr = await chs(message, client, client.misc.cache.chars.random(), -100000); let asr = await chs(message, client, client.misc.cache.chars.random(), -100000);
return await message.channel.send({embeds: [asr.embed]}); return await message.channel.send({embeds: [asr.embed]});

Loading…
Cancel
Save