2023-05-25 07:28:28 +00:00
|
|
|
from contextlib import closing
|
|
|
|
|
2023-04-25 11:25:53 +00:00
|
|
|
async def join_callback(response, bot):
|
|
|
|
bot.logger.log(
|
|
|
|
f"Join response received for room {response.room_id}", "debug")
|
|
|
|
|
|
|
|
bot.matrix_client.joined_rooms()
|
|
|
|
|
2023-05-25 07:28:28 +00:00
|
|
|
with closing(bot.database.cursor()) as cursor:
|
2023-05-09 10:27:03 +00:00
|
|
|
cursor.execute(
|
2024-05-18 19:37:51 +00:00
|
|
|
"SELECT space_id FROM user_spaces WHERE user_id = ? AND active = TRUE", (response.sender,))
|
2023-05-09 10:27:03 +00:00
|
|
|
space = cursor.fetchone()
|
|
|
|
|
|
|
|
if space:
|
|
|
|
bot.logger.log(f"Adding new room to space {space[0]}...")
|
2024-05-18 19:37:51 +00:00
|
|
|
await bot.add_rooms_to_space(space[0], [response.room_id])
|
2023-05-09 10:27:03 +00:00
|
|
|
|
2023-11-11 16:22:43 +00:00
|
|
|
bot.matrix_client.keys_upload()
|
|
|
|
|
2023-04-25 11:25:53 +00:00
|
|
|
await bot.send_message(bot.matrix_client.rooms[response.room_id], "Hello! Thanks for inviting me! How can I help you today?")
|