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

[BUG] TypeError: int() argument must be a string, a bytes-like object or a number, not 'NoneType' #510

Closed
dontbanmeplz opened this issue Feb 11, 2022 · 31 comments
Assignees
Labels
bug Something isn't working

Comments

@dontbanmeplz
Copy link

dontbanmeplz commented Feb 11, 2022

Describe the bug
message should delete but cannot find id of message
Reproducing steps
These are the steps I took in order to produce this bug, which should be able to be reproduced for everyone else as well.

  1. Import the module in Python.
  2. Create a client variable for the library.
  3. Try creating a slash command.
  4. send a message
  5. Delete the message
  6. See the traceback error given in the terminal or logger file.

What's normally expected
The message should be deleted

What actually happened
Instead, I received this traceback error given from my Python terminal:

Traceback (most recent call last):
  File "/root/inter/main.py", line 233, in buy
    await n.delete()
  File "/usr/local/lib/python3.8/dist-packages/interactions/api/models/message.py", line 335, in delete
    message_id=int(self.id), channel_id=int(self.channel_id), reason=reason
TypeError: int() argument must be a string, a bytes-like object or a number, not 'NoneType'

code:
https://pastebin.com/qfJU76TF
Versions
newest unstable
wait_for

@dontbanmeplz dontbanmeplz added the bug Something isn't working label Feb 11, 2022
@EdVraz
Copy link
Contributor

EdVraz commented Feb 11, 2022

could you try without wait_for?

@dontbanmeplz
Copy link
Author

it shouldent make a diffrence, it is not inside or looking from a wait_for

@i0bs
Copy link
Contributor

i0bs commented Feb 11, 2022

delete() is functioning fine for me, but it's a good rule of thumb to isolate dependencies and see if it's an issue relating to ours or another one.

@dontbanmeplz
Copy link
Author

it works with just a normal send sleep and delete, i dont know the problem with the code i have

@EdVraz
Copy link
Contributor

EdVraz commented Feb 11, 2022

Could you try to use ctx.delete() instead? I believe this solved that problem once

@dontbanmeplz
Copy link
Author

did nothing with no error

@EdVraz
Copy link
Contributor

EdVraz commented Feb 11, 2022

Try to uninstall the "latest" unstable version and then reinstall it, for me it works fine even if in a command.

@dontbanmeplz
Copy link
Author

nothing

@EdVraz
Copy link
Contributor

EdVraz commented Feb 11, 2022

and with the n.delete()?

@dontbanmeplz
Copy link
Author

Traceback (most recent call last):
  File "/root/inter/main.py", line 232, in buy
    await n.delete()
  File "/usr/local/lib/python3.8/dist-packages/interactions/api/models/message.py", line 335, in delete
    message_id=int(self.id), channel_id=int(self.channel_id), reason=reason
TypeError: int() argument must be a string, a bytes-like object or a number, not 'NoneType'

same error as before

@EdVraz
Copy link
Contributor

EdVraz commented Feb 11, 2022

That's so weird because I cannot reproduce it.

@dontbanmeplz
Copy link
Author

did you look at the pastebin code?

@EdVraz
Copy link
Contributor

EdVraz commented Feb 11, 2022

a = await ctx.send("a", components=Button(style=ButtonStyle.DANGER, label="Test", custom_id="none"))
await a.delete()

I was trying with this and it worked fine.

@dontbanmeplz
Copy link
Author

for some reason it is only failing on that send
it works fine in another part of my program

@EdVraz
Copy link
Contributor

EdVraz commented Feb 11, 2022

does the other part has a wait_for?

@dontbanmeplz
Copy link
Author

i did both, and it works with and without

@EdVraz
Copy link
Contributor

EdVraz commented Feb 11, 2022

could you show your component code`?

@dontbanmeplz
Copy link
Author

@EdVraz
Copy link
Contributor

EdVraz commented Feb 11, 2022

grafik
i don't see this part there

@dontbanmeplz
Copy link
Author

yny = interactions.Button(
    style=interactions.ButtonStyle.SUCCESS,
    label="Yes",
    custom_id="yes",
)
ynn = interactions.Button(
    style=interactions.ButtonStyle.DANGER,
    label="No",
    custom_id="no",
)
yn = [yny,ynn]

my bad

@EdVraz
Copy link
Contributor

EdVraz commented Feb 11, 2022

hm
they're fine, too

idk whats wrong then

@dontbanmeplz
Copy link
Author

yeah its odd because it works everywhere else

@Catalyst4222
Copy link
Contributor

Is the message you're trying to delete a hidden message?

@EdVraz
Copy link
Contributor

EdVraz commented Feb 11, 2022

Is the message you're trying to delete a hidden message?

It's not, you can look in the pastebin

@dontbanmeplz
Copy link
Author

@Catalyst4222 no look at the code

@dontbanmeplz
Copy link
Author

Any suggestions?

@laToufff
Copy link

i have the same issue with the .edit() method. It sends the message from the Context object, but then I fails to edit and log the same error message as you.

@FayeDel
Copy link
Collaborator

FayeDel commented Feb 11, 2022

Hiya!

I noticed you included the print(n._json) line right before that error on your traceback, mind showing me what that returns?

@dontbanmeplz
Copy link
Author

dontbanmeplz commented Feb 11, 2022

@DeltaXWizard thought it woud shed some light but it didnt

{'content': 'Do you wish to buy 2 AAPL with a total cost of 340.88?', 'tts': False, 'embeds': [], 'allowed_mentions': {}, 'components': [{'type': 1, 'components': [{'style': 3, 'label': 'Yes', 'custom_id': 'yes', 'type': 2}, {'style': 4, 'label': 'No', 'custom_id': 'no', 'type': 2}]}], 'flags': 0}

@FayeDel
Copy link
Collaborator

FayeDel commented Feb 11, 2022

It does thank you :)
Would you mind updating your instance to latest unstable and try again?

@FayeDel FayeDel self-assigned this Feb 11, 2022
@dontbanmeplz
Copy link
Author

@DeltaXWizard that fixed it, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

6 participants