join.py 654 B

12345678910111213141516
  1. async def join_callback(response, bot):
  2. bot.logger.log(
  3. f"Join response received for room {response.room_id}", "debug")
  4. bot.matrix_client.joined_rooms()
  5. with bot.database.cursor() as cursor:
  6. cursor.execute(
  7. "SELECT space_id FROM user_spaces WHERE user_id = ? AND active = TRUE", (event.sender,))
  8. space = cursor.fetchone()
  9. if space:
  10. bot.logger.log(f"Adding new room to space {space[0]}...")
  11. await bot.add_rooms_to_space(space[0], [new_room.room_id])
  12. await bot.send_message(bot.matrix_client.rooms[response.room_id], "Hello! Thanks for inviting me! How can I help you today?")