Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Duel accept issue #242

Closed
Ajay01028 opened this issue May 22, 2022 · 3 comments
Closed

Duel accept issue #242

Ajay01028 opened this issue May 22, 2022 · 3 comments
Labels
bug: unconfirmed Potential bugs that need replicating to verify. status: not enough info Issues that require more information to be provided, either by the author or through investigation.

Comments

@Ajay01028
Copy link

Whenever a user accept the duel challenge bot edit that message to "." and doesn't start a game

@utarwyn utarwyn added bug: unconfirmed Potential bugs that need replicating to verify. status: not enough info Issues that require more information to be provided, either by the author or through investigation. labels Jun 20, 2022
@Gorniaky
Copy link
Contributor

Gorniaky commented Jul 22, 2022

I already got this error too, most likely you are doing this:

JSON.parse(<ButtonInteraction>.customId);

When the customId is "yes" or "no", JSON.parse throws an error

The solution I found was to write a function with try/catch

function JSONparse(customId) {
  try {
    return JSON.parse(customId);
  } catch {
    return;
  }
}

With that, you won't have any more problems.

@utarwyn
Copy link
Owner

utarwyn commented Jul 27, 2022

Hello @Gorniaky, I don't understand where to fix this in the module source code?

@Gorniaky
Copy link
Contributor

@utarwyn the problem is not in the module itself, but when we load a customId that is not encoded in JSON and try to decode it with JSON.parse, an error occurs, but there is a solution to this problem: if you use numbers to confirm the duel , "1" for "yes" and "0" for "no", JSON.parse has no problem with numbers.

@utarwyn utarwyn closed this as completed Sep 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug: unconfirmed Potential bugs that need replicating to verify. status: not enough info Issues that require more information to be provided, either by the author or through investigation.
Projects
None yet
Development

No branches or pull requests

3 participants