ifo / gozulipbot

A bot library in Go for Zulip
ISC License
17 stars 6 forks source link

getEvents is causing error #2

Open rht opened 4 years ago

rht commented 4 years ago

@ifo this is a bug reported from Matterbridge: https://github.com/42wim/matterbridge/issues/1047. The gist is that getEvents is not capturing any event from the Zulip side to be sent over to IRC / Slack side. There has been a conjecture in this comment that the cause might be https://github.com/zulip/zulip/commit/86a7fdddd7776cc225f888f30f040524274ac24b.

ifo commented 4 years ago

Hey thanks! Yeah, I recently started fixing a bot of mine that uses this and found out that getEvents didn't work due to me passing the wrong last event id. Turns out I'd been doing it wrong the entire time! I'd thought the last event id should be the largest ID of the events you'd seen, and assumed that was something like the message id, rather than the actual id of the event being passed back. I fixed it with https://github.com/ifo/gozulipbot/commit/684aca9fd4ba35854f460e55b9000805f2e8eb6b, and also fixed reactions, which were using an outdated api endpoint.

Updating matterbridge's go.mod to require github.com/ifo/gozulipbot v0.0.0-20200725193743-f965bc443509 should fix things.

Thanks for reporting this and let me know if that works!

ifo commented 4 years ago

Actually, scratch that. I found some bad bugs with EventsChan, EventsCallback and ParseEventMessages (essentially they'll fail as soon as they get a heartbeat message). I fixed those and tagged the first module version of this at v0.0.1.

rht commented 4 years ago

Great, I will test on Matterbridge soon.

rht commented 4 years ago

I just tested by creating a bridge (via Matterbridge) between irc.freenode.net of #python-mypy and chat.zulip.org of #test-here. The message from freenode gets relayed to Zulip, but still not the other way around. Maybe I will ask the Matterbridge author to test it instead. There are several patches to ifo/gozulipbot done by Matterbridge, and I patched the code manually.