utils.selectionMessage: fix race condition by adding clever id checking
This commit is contained in:
parent
c2bed24794
commit
c3e94cd593
1 changed files with 3 additions and 2 deletions
|
@ -174,7 +174,7 @@ async function selectionMessage(msg, heading, options, timeout = 30000) {
|
||||||
components: [
|
components: [
|
||||||
{
|
{
|
||||||
type: 3,
|
type: 3,
|
||||||
custom_id: "selection",
|
custom_id: msg.id,
|
||||||
options: [],
|
options: [],
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
@ -212,7 +212,8 @@ async function selectionMessage(msg, heading, options, timeout = 30000) {
|
||||||
|
|
||||||
if (
|
if (
|
||||||
user.id == msg.author.id &&
|
user.id == msg.author.id &&
|
||||||
interaction.channel_id == msg.channel.id
|
interaction.channel_id == msg.channel.id &&
|
||||||
|
interaction.message.components[0].components[0].custom_id == msg.id
|
||||||
) {
|
) {
|
||||||
if (interaction.data.custom_id == "cancel") {
|
if (interaction.data.custom_id == "cancel") {
|
||||||
hf.events.remove("unknown", `selection.${msg.id}`);
|
hf.events.remove("unknown", `selection.${msg.id}`);
|
||||||
|
|
Loading…
Reference in a new issue