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.
This commit is contained in:
Andrew Morgan 2020-05-05 00:10:18 +01:00
parent 2700cfcd7b
commit 22c5b46af0

View file

@ -7,13 +7,13 @@ from nio import (
AsyncClient, AsyncClient,
AsyncClientConfig, AsyncClientConfig,
RoomMessageText, RoomMessageText,
InviteEvent, InviteMemberEvent,
LoginError, LoginError,
LocalProtocolError, LocalProtocolError,
) )
from aiohttp import ( from aiohttp import (
ServerDisconnectedError, ServerDisconnectedError,
ClientConnectionError, ClientConnectionError
) )
from callbacks import Callbacks from callbacks import Callbacks
from config import Config from config import Config
@ -49,7 +49,7 @@ async def main():
# Set up event callbacks # Set up event callbacks
callbacks = Callbacks(client, store, config) callbacks = Callbacks(client, store, config)
client.add_event_callback(callbacks.message, (RoomMessageText,)) 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) # Keep trying to reconnect on failure (with some time in-between)
while True: while True: