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

[*.0] 🐛 Fix conflict between two different buttons #87

Open
MasterCruelty opened this issue Nov 2, 2022 · 11 comments
Open

[*.0] 🐛 Fix conflict between two different buttons #87

MasterCruelty opened this issue Nov 2, 2022 · 11 comments
Assignees
Labels
bug Something isn't working good first issue Good for newcomers help wanted Extra attention is needed medium priority If it can be fixed early, it's better refactor Refactored code

Comments

@MasterCruelty
Copy link
Owner

MasterCruelty commented Nov 2, 2022

Typing /urban argument1 and then /urban argument2 will be resulting in a conflict because if you press the button of the first command you get the next page of argument1 but if you press the button of the second command, you get still the next page of argument1 instead of argument2.

I used /urban as an example but the problem is intended in every function that uses Inline buttons.

urban.py

@MasterCruelty MasterCruelty added bug Something isn't working medium priority If it can be fixed early, it's better refactor Refactored code labels Nov 2, 2022
@MasterCruelty MasterCruelty self-assigned this Nov 2, 2022
@MasterCruelty
Copy link
Owner Author

Edit: This problem is probably linked with using global variables

@MasterCruelty MasterCruelty added help wanted Extra attention is needed good first issue Good for newcomers labels Nov 10, 2022
@Kd-Here
Copy link

Kd-Here commented Nov 19, 2022

Can i help you in that @MasterCruelty ?

@MasterCruelty
Copy link
Owner Author

Can i help you in that @MasterCruelty ?

Of course you can!
Here you find a few guidelines to contribute to the project. (The first step is done because there's already an issue)
These are the files affected: weather.py, lyrics.py, urban.py

Do you have any idea to do this?

@Kd-Here
Copy link

Kd-Here commented Nov 20, 2022

Currently I don't have any idea for now.
But I will run code in my system first after checking function I get the idea 👍

@MasterCruelty
Copy link
Owner Author

Currently I don't have any idea for now.
But I will run code in my system first after checking function I get the idea 👍

Got it! Let me know after your check 👌

@MasterCruelty
Copy link
Owner Author

@archetipico do you have any idea to solve?

@archetipico
Copy link
Contributor

I'll look at it as soon as I have free time

@MasterCruelty
Copy link
Owner Author

The next issue I'll try to fix is this One as soon as I have an hour or two to spend on it.

@MasterCruelty MasterCruelty changed the title [2.0] 🐛 Fix conflict between two different buttons [1.0] 🐛 Fix conflict between two different buttons Sep 10, 2023
@MasterCruelty MasterCruelty changed the title [1.0] 🐛 Fix conflict between two different buttons [3.0] 🐛 Fix conflict between two different buttons Sep 10, 2023
@MasterCruelty MasterCruelty changed the title [3.0] 🐛 Fix conflict between two different buttons [*.0] 🐛 Fix conflict between two different buttons Sep 10, 2023
@MasterCruelty
Copy link
Owner Author

@archetipico Any ideas?

@archetipico
Copy link
Contributor

The last time I wrote here was March 31... I forgot about this issue.

May I suggest that instead of using global k you just pass the variable to the function, like this

def press_button(client, message, k)
    ... # your code without global k

I think the global keyword is initializing k everytime (I may be wrong, but trying isn't harmful)

@MasterCruelty
Copy link
Owner Author

The last time I wrote here was March 31... I forgot about this issue.

May I suggest that instead of using global k you just pass the variable to the function, like this

def press_button(client, message, k)
    ... # your code without global k

I think the global keyword is initializing k everytime (I may be wrong, but trying isn't harmful)

If I'm not wrong(it's a bit since my last reiew of that code), that's the problem.
If you use global variables it "works" with this issue, but if you use local variables, you can't increment it when you press the button because the new istance has no memory of that variable(it's in the older process, not the current)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers help wanted Extra attention is needed medium priority If it can be fixed early, it's better refactor Refactored code
Projects
None yet
Development

No branches or pull requests

3 participants