matrix-reportbot/callbacks/invite.py
Kumi 1dc0378853
Create a bot class
Make everything compatible with that
2023-04-25 11:25:53 +00:00

10 lines
No EOL
382 B
Python

from nio import InviteEvent, MatrixRoom
async def room_invite_callback(room: MatrixRoom, event: InviteEvent, bot):
if room.room_id in bot.matrix_client.rooms:
logging(f"Already in room {room.room_id} - ignoring invite")
return
bot.logger.log(f"Received invite to room {room.room_id} - joining...")
response = await bot.matrix_client.join(room.room_id)