From 22c5b46af08cb0b4646a0b022386c480fd092af7 Mon Sep 17 00:00:00 2001 From: Andrew Morgan Date: Tue, 5 May 2020 00:10:18 +0100 Subject: [PATCH] Use InviteMemberEvent instead of InviteEvent. InviteMemberEvent is for when you're invited, whereas the latter is when there is an event in a room you're invited to, which has false positives. --- main.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/main.py b/main.py index 47d9317..ecdd1eb 100644 --- a/main.py +++ b/main.py @@ -7,13 +7,13 @@ from nio import ( AsyncClient, AsyncClientConfig, RoomMessageText, - InviteEvent, + InviteMemberEvent, LoginError, LocalProtocolError, ) from aiohttp import ( ServerDisconnectedError, - ClientConnectionError, + ClientConnectionError ) from callbacks import Callbacks from config import Config @@ -49,7 +49,7 @@ async def main(): # Set up event callbacks callbacks = Callbacks(client, store, config) client.add_event_callback(callbacks.message, (RoomMessageText,)) - client.add_event_callback(callbacks.invite, (InviteEvent,)) + client.add_event_callback(callbacks.invite, (InviteMemberEvent,)) # Keep trying to reconnect on failure (with some time in-between) while True: