I'm writting a bot (again), and while browsing through my old code to remind me of how the API works, I've been reminded of that time I wrote a bot using the Mastodon API wrapper for Python. But the bot was hosted on a Pleroma instance (our pleroma).
Turns out, Pleroma doesn't (or didn't at the time) have a streaming API like Mastodon does. So what I did was to create a class that simulated a streaming API, by constantly reading the notifications and checking if there were new notifications since the last time checked, and then using a callback passing the notification to it.
All because I didn't want to write my own API wrapper and I wanted to stick to Mastodon.py. But it worked.
https://gitlab.com/enigmatico/maira-bot/-/blob/main/MastoAPI.py?ref_type=heads
Embed Notice
HTML Code
Corresponding Notice
- Embed this notice
【Ξnigmatico】:misskey: (enigmatico@mk.absturztau.be)'s status on Saturday, 08-Feb-2025 04:36:35 JST 【Ξnigmatico】:misskey: