mirror of
https://github.com/williamkray/maubot-kickbot.git
synced 2024-10-01 06:05:46 -04:00
fix some error handling if the bot is not in a room in the space
This commit is contained in:
parent
3706594738
commit
a4c31c7a14
@ -197,10 +197,11 @@ class KickBot(Plugin):
|
|||||||
for user in purgeable:
|
for user in purgeable:
|
||||||
purge_list[user] = []
|
purge_list[user] = []
|
||||||
for room in roomlist:
|
for room in roomlist:
|
||||||
|
try:
|
||||||
|
roomname = None
|
||||||
roomnamestate = await self.client.get_state_event(room, 'm.room.name')
|
roomnamestate = await self.client.get_state_event(room, 'm.room.name')
|
||||||
roomname = roomnamestate['name']
|
roomname = roomnamestate['name']
|
||||||
|
|
||||||
try:
|
|
||||||
await self.client.get_state_event(room, EventType.ROOM_MEMBER, user)
|
await self.client.get_state_event(room, EventType.ROOM_MEMBER, user)
|
||||||
await self.client.kick_user(room, user, reason='inactivity')
|
await self.client.kick_user(room, user, reason='inactivity')
|
||||||
if roomname:
|
if roomname:
|
||||||
@ -213,10 +214,7 @@ class KickBot(Plugin):
|
|||||||
except Exception as e:
|
except Exception as e:
|
||||||
self.log.warning(e)
|
self.log.warning(e)
|
||||||
error_list[user] = []
|
error_list[user] = []
|
||||||
if roomname:
|
error_list[user].append(roomname or room)
|
||||||
error_list[user].append(roomname)
|
|
||||||
else:
|
|
||||||
error_list[user].append(room)
|
|
||||||
|
|
||||||
|
|
||||||
results = "the following users were purged:<p><code>{purge_list}</code></p>the following errors were \
|
results = "the following users were purged:<p><code>{purge_list}</code></p>the following errors were \
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
maubot: 0.1.0
|
maubot: 0.1.0
|
||||||
id: org.jobmachine.kickbot
|
id: org.jobmachine.kickbot
|
||||||
version: 0.0.9
|
version: 0.0.10
|
||||||
license: MIT
|
license: MIT
|
||||||
modules:
|
modules:
|
||||||
- kickbot
|
- kickbot
|
||||||
|
Loading…
Reference in New Issue
Block a user