delete own messages in some anime q&a

master
Kit Kasune 3 years ago
parent a02ea2bed1
commit 681f2c95dd
  1. 5
      commands/anime/char.js
  2. 5
      commands/anime/highvalue.js
  3. 5
      commands/anime/lovechar.js
  4. 5
      commands/anime/watched.js
  5. 7
      commands/anime/watchlist.js
  6. 13
      util/ask.js

@ -304,10 +304,11 @@ module.exports = {
}
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);
let preConfEmbed = await message.channel.send({embeds: [asr.embed]});
let conf = await ask(message, "Is this the character you meant?", 60000, undefined, undefined, true);
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());
preConfEmbed.delete().catch(() => {});
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;
}

@ -43,10 +43,11 @@ module.exports = {
}
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);
let preConfEmbed = await message.channel.send({embeds: [asr.embed]});
let conf = await ask(message, "Is this the character you meant?", 60000, undefined, undefined, true);
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());
preConfEmbed.delete().catch(() => {});
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;
}

@ -59,10 +59,11 @@ module.exports = {
}
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);
let preConfEmbed = await message.channel.send({embeds: [asr.embed]});
let conf = await ask(message, "Is this the character you meant?", 60000, undefined, undefined, true);
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());
preConfEmbed.delete().catch(() => {});
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;
}

@ -71,10 +71,11 @@ module.exports = {
}
else {return message.reply("Looks like you didn't find the anime you were looking for.");}
} else {
await message.channel.send({embeds: [asr.embed]});
let conf = await ask(message, "Is this the anime you meant?", 60000);
let preConfEmbed = await message.channel.send({embeds: [asr.embed]});
let conf = await ask(message, "Is this the anime you meant?", 60000, undefined, undefined, true);
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());
preConfEmbed.delete().catch(() => {});
if (!conf) {return message.channel.send("Well, I've got nothing, then. If that doesn't match the anime you're looking for then I would try again with a more narrow search.");}
fn = asr.id;}
let af = await AF.findOne({uid: message.author.id}) || new AF({uid: message.author.id});

@ -77,10 +77,11 @@ module.exports = {
}
else {return message.reply("Looks like you didn't find the anime you were looking for.");}
} else {
await message.channel.send({embeds: [asr.embed]});
let conf = await ask(message, "Is this the anime you meant?", 60000);
let preConfEmbed = await message.channel.send({embeds: [asr.embed]});
let conf = await ask(message, "Is this the anime you meant?", 60000, undefined, undefined, true);
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());
preConfEmbed.delete().catch(() => {});
if (!conf) {return message.channel.send("Well, I've got nothing, then. If that doesn't match the anime you're looking for then I would try again with a more narrow search.");}
fn = asr.id;}
let af = await AF.findOne({uid: message.author.id}) || new AF({uid: message.author.id});
@ -122,7 +123,7 @@ module.exports = {
else {return message.reply("Looks like you didn't find the anime you were looking for.");}
} else {
await message.channel.send({embeds: [asr.embed]});
let conf = await ask(message, "Is this the anime you meant?", 60000);
let conf = await ask(message, "Is this the anime you meant?", 60000, undefined, undefined, true);
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 anime you're looking for then I would try again with a more narrow search.");}

@ -1,10 +1,15 @@
module.exports = async (message, toAsk, time, nofilter, timeoutResponse) => {
module.exports = async (message, toAsk, time, nofilter, timeoutResponse, deleteAfter) => {
let msg = await message.channel.send(toAsk);
let filter = nofilter ? () => true : m => m.author.id === message.author.id;
try {
let collected = await msg.channel.awaitMessages({filter: filter, max: 1, errors: ['time'], time: time});
if (collected.first().attachments.size > 0) {collected = collected.first().attachments.first().url;}
else {collected = collected.first().content;}
let collectedO = await msg.channel.awaitMessages({filter: filter, max: 1, errors: ['time'], time: time});
let collected;
if (collectedO.first().attachments.size > 0) {collected = collectedO.first().attachments.first().url;}
else {collected = collectedO.first().content;}
if (deleteAfter) {
msg.delete().catch(() => {});
collectedO.first().delete().catch(() => {});
}
return collected;
} catch {
if (timeoutResponse) {message.reply("This question has timed out! Please try again.");}

Loading…
Cancel
Save