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:
|
||||
purge_list[user] = []
|
||||
for room in roomlist:
|
||||
try:
|
||||
roomname = None
|
||||
roomnamestate = await self.client.get_state_event(room, 'm.room.name')
|
||||
roomname = roomnamestate['name']
|
||||
|
||||
try:
|
||||
await self.client.get_state_event(room, EventType.ROOM_MEMBER, user)
|
||||
await self.client.kick_user(room, user, reason='inactivity')
|
||||
if roomname:
|
||||
@ -213,10 +214,7 @@ class KickBot(Plugin):
|
||||
except Exception as e:
|
||||
self.log.warning(e)
|
||||
error_list[user] = []
|
||||
if roomname:
|
||||
error_list[user].append(roomname)
|
||||
else:
|
||||
error_list[user].append(room)
|
||||
error_list[user].append(roomname or room)
|
||||
|
||||
|
||||
results = "the following users were purged:<p><code>{purge_list}</code></p>the following errors were \
|
||||
|
@ -1,6 +1,6 @@
|
||||
maubot: 0.1.0
|
||||
id: org.jobmachine.kickbot
|
||||
version: 0.0.9
|
||||
version: 0.0.10
|
||||
license: MIT
|
||||
modules:
|
||||
- kickbot
|
||||
|
Loading…
Reference in New Issue
Block a user