From 65d865560fdaf2806238ecfd327a9b5496246586 Mon Sep 17 00:00:00 2001 From: WubzyGD Date: Sun, 16 Jan 2022 01:07:33 -0700 Subject: [PATCH] anime msg cleanup for paginations --- commands/anime/char.js | 6 ++++-- commands/anime/highvalue.js | 6 ++++-- commands/anime/lovechar.js | 6 ++++-- commands/anime/watched.js | 6 ++++-- commands/anime/watchlist.js | 6 ++++-- 5 files changed, 20 insertions(+), 10 deletions(-) diff --git a/commands/anime/char.js b/commands/anime/char.js index a3c5bf2..13b22cc 100644 --- a/commands/anime/char.js +++ b/commands/anime/char.js @@ -293,14 +293,16 @@ module.exports = { } 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 noticeDel = 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(); + await asr.stop(); + await asr.message.delete().catch(() => {}); + await noticeDel.delete().catch(() => {}); } else {return message.reply("Looks like you didn't find the character you were looking for.");} } else { diff --git a/commands/anime/highvalue.js b/commands/anime/highvalue.js index c6341c7..dca6b84 100644 --- a/commands/anime/highvalue.js +++ b/commands/anime/highvalue.js @@ -32,14 +32,16 @@ module.exports = { } 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 noticeDel = 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(); + await asr.stop(); + await asr.message.delete().catch(() => {}); + await noticeDel.delete().catch(() => {}); } else {return message.reply("Looks like you didn't find the character you were looking for.");} } else { diff --git a/commands/anime/lovechar.js b/commands/anime/lovechar.js index c598372..7718f67 100644 --- a/commands/anime/lovechar.js +++ b/commands/anime/lovechar.js @@ -48,14 +48,16 @@ module.exports = { } 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 noticeDel = 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, u) => ['✅', '⏹'].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(); + await asr.stop(); + await asr.message.delete().catch(() => {}); + await noticeDel.delete().catch(() => {}); } else {return message.reply("Looks like you didn't find the character you were looking for.");} } else { diff --git a/commands/anime/watched.js b/commands/anime/watched.js index 94f0221..9fe285d 100644 --- a/commands/anime/watched.js +++ b/commands/anime/watched.js @@ -60,14 +60,16 @@ module.exports = { } 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 anime you want!"); + let noticeDel = await message.channel.send("React with :white_check_mark: when you've found the anime 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 anime you were looking for.");} collected = arc.first().emoji.name; if (collected === '✅') { fn = client.misc.cache.anime.get(asr.getCurrentPage().title.trim()); - asr.stop(); + await asr.stop(); + await asr.message.delete().catch(() => {}); + await noticeDel.delete().catch(() => {}); } else {return message.reply("Looks like you didn't find the anime you were looking for.");} } else { diff --git a/commands/anime/watchlist.js b/commands/anime/watchlist.js index 9b0deab..2205bf5 100644 --- a/commands/anime/watchlist.js +++ b/commands/anime/watchlist.js @@ -66,14 +66,16 @@ module.exports = { } 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 anime you want!"); + let noticeDel = await message.channel.send("React with :white_check_mark: when you've found the anime 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 anime you were looking for.");} collected = arc.first().emoji.name; if (collected === '✅') { fn = client.misc.cache.anime.get(asr.getCurrentPage().title.trim()); - asr.stop(); + await asr.stop(); + await asr.message.delete().catch(() => {}); + await noticeDel.delete().catch(() => {}); } else {return message.reply("Looks like you didn't find the anime you were looking for.");} } else {