Make puppets leave room instead of kicking by AS bot

This commit is contained in:
Tulir Asokan
2018-03-11 13:09:04 +02:00
parent 4448077d43
commit 54d2b4bba8
+6 -3
View File
@@ -494,10 +494,13 @@ class Portal:
except MatrixRequestError:
members = []
for user in members:
is_puppet = p.Puppet.get_id_from_mxid(user)
if user != intent.mxid and (not puppets_only or is_puppet):
puppet = p.Puppet.get_by_mxid(user, create=False)
if user != intent.mxid and (not puppets_only or puppet):
try:
await intent.kick(room_id, user, message)
if puppet:
await puppet.intent.leave_room(room_id)
else:
await intent.kick(room_id, user, message)
except (MatrixRequestError, IntentError):
pass
await intent.leave_room(room_id)