Log to console when a user cannot join a room

This commit is contained in:
Austen Adler 2017-10-26 11:26:51 -04:00
parent 8e85ba99e5
commit 7b8def4107

View File

@ -449,7 +449,10 @@ async def register_join_matrix(chat, room_id, user_id):
await matrix_put('client', 'profile/{}/displayname'.format(user_id), await matrix_put('client', 'profile/{}/displayname'.format(user_id),
user_id, {'displayname': name}) user_id, {'displayname': name})
await matrix_post('client', 'join/{}'.format(room_id), user_id, {}) j = await matrix_post('client', 'join/{}'.format(room_id), user_id, {})
if 'errcode' in j and j['errcode'] == 'M_FORBIDDEN':
print("Error with <{}> joining room <{}>. This is likely because guests are not allowed to join the room."
.format(user_id, room_id))
async def update_matrix_displayname_avatar(tg_user): async def update_matrix_displayname_avatar(tg_user):
name = tg_user['first_name'] name = tg_user['first_name']