Closed db0 closed 1 year ago
What you're doing seems broadly correct, but the ID used seems weird. I think you're maybe passing in the ID of the status, rather than of the notification?
Example of what works (just tested), returns "2":
len(mastodon.notifications(min_id = mastodon.notifications()[2]))
should note that, despite what mastodon.py currently does, notification ids are not actually snowflake IDs, either, and I need to remove date unpacking from those parameters. But searching by min/max/since-ID should work, and does, as far as I can tell
So I pass a whole element of the notifications()
array? Let me try and I'll tell you
Either that, or the "id" element from that, so for example
len(mastodon.notifications(min_id = mastodon.notifications()[2].id))
is the same as
len(mastodon.notifications(min_id = mastodon.notifications()[2]))
Mastodon.py will internally unpack the ID from the object for you if you pass the object, because it makes code a little easier to read.
Generally, everything that takes the pagination attributes (min/max/since_id) will use the IDs from the objects returned from that call, so notification id for notification, status id for status, etc.
P.S.: If what you're trying to do is get up to date notifications as they come in, have a look at the Streaming API (specifically stream_user
) - it's a bit more complicated to use, but may let you do what you want to more efficiently (with some caveats)
No nothing like that. I'm building this https://sigmoid.social/@stablehorde_generator :)
I'm assuming what you want to do is react to when the bot get mentioned? In that case, the streaming API would actually probably work quite well, but so will just polling notifications every few minutes.
In any case, I guess I can close this? if not, feel free to reopen.
Worked. Yes you can close. Thanks for the support!
I'm trying to get all notifications since a specific ID
I've tried with
min_id
and withsince_id
I've also tried with Id being in a dictionary like so
{'id': 109381418697881490}
and with it being sent as a simple integer109381418697881490
. I always get an empty list returned.However I know I have a notification with a higher ID available
If I comment out the
min_id
key and put some prints: