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

$if statement runs both sides #664

Closed
1 task done
LightslicerGP opened this issue Oct 6, 2024 · 2 comments
Closed
1 task done

$if statement runs both sides #664

LightslicerGP opened this issue Oct 6, 2024 · 2 comments
Assignees

Comments

@LightslicerGP
Copy link

Bug Type

Function

Bugged Behavior

module.exports = [
  {
    name: "whois",
    code: `
        $clientTyping    
        $reply[$messageID;true]

        $if[$isNumber[$noMentionMessage]==true;
            true $userTag[$message];
            false $userID[$message]
        ]
    `,
  },
];

Version of aoi.js

v6.8.x

Version of Node.js

v20.16.0 (LTS)

Excepted Output

image

So the issue is the $if functions (and many others like it iirc) work like this:

  1. Check the comparison
  2. Run both sides of the function
  3. Disregard any data that is NOT on the correct side

The problem is, if ONE side (doesn't matter which since they both run anyway) runs into an error, the ENTIRE thing breaks and doesn't run.

What it should do is NOT run the side that doesn't match the condition, so it never gets that error in the first place.

It should only run one side, the side that matches weather it is True or false, but BOTH sides run and it causes problems.

Relevant log output

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct
@LightslicerGP
Copy link
Author

Update: this might be relevant to the issue: #559

@Faf4a
Copy link
Member

Faf4a commented Oct 7, 2024

this is a known issue, related to #559

@Faf4a Faf4a closed this as not planned Won't fix, can't repro, duplicate, stale Oct 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants