Catch some extra message deletes
This commit is contained in:
parent
db068cee60
commit
e01eaa4876
1 changed files with 10 additions and 2 deletions
|
@ -120,7 +120,11 @@ export default async (client, message, pages, timeout = 120000) => {
|
||||||
let ended = false;
|
let ended = false;
|
||||||
dropdownCollector.on("interaction", async (response) => {
|
dropdownCollector.on("interaction", async (response) => {
|
||||||
if (response.data.custom_id !== "seekDropdown") return;
|
if (response.data.custom_id !== "seekDropdown") return;
|
||||||
if (await client.getMessage(askMessage.channel.id, askMessage.id).catch(() => undefined)) await askMessage.delete();
|
try {
|
||||||
|
if (await client.getMessage(askMessage.channel.id, askMessage.id).catch(() => undefined)) await askMessage.delete();
|
||||||
|
} catch {
|
||||||
|
// no-op
|
||||||
|
}
|
||||||
page = Number(response.data.values[0]);
|
page = Number(response.data.values[0]);
|
||||||
currentPage = await currentPage.edit(Object.assign(pages[page], options, components));
|
currentPage = await currentPage.edit(Object.assign(pages[page], options, components));
|
||||||
ended = true;
|
ended = true;
|
||||||
|
@ -128,7 +132,11 @@ export default async (client, message, pages, timeout = 120000) => {
|
||||||
});
|
});
|
||||||
dropdownCollector.once("end", async () => {
|
dropdownCollector.once("end", async () => {
|
||||||
if (ended) return;
|
if (ended) return;
|
||||||
if (await client.getMessage(askMessage.channel.id, askMessage.id).catch(() => undefined)) await askMessage.delete();
|
try {
|
||||||
|
if (await client.getMessage(askMessage.channel.id, askMessage.id).catch(() => undefined)) await askMessage.delete();
|
||||||
|
} catch {
|
||||||
|
// no-op
|
||||||
|
}
|
||||||
currentPage = await currentPage.edit(Object.assign(pages[page], options, components));
|
currentPage = await currentPage.edit(Object.assign(pages[page], options, components));
|
||||||
});
|
});
|
||||||
}).catch(error => {
|
}).catch(error => {
|
||||||
|
|
Loading…
Reference in a new issue