mirror of
https://github.com/williamkray/maubot-kickbot.git
synced 2024-10-01 06:05:46 -04:00
remember to wrap purging in admin check
This commit is contained in:
parent
161c6f04ad
commit
d02636d18a
@ -184,6 +184,7 @@ class KickBot(Plugin):
|
|||||||
@activity.subcommand("purge", help='kick users for excessive inactivity')
|
@activity.subcommand("purge", help='kick users for excessive inactivity')
|
||||||
async def kick_users(self, evt: MessageEvent) -> None:
|
async def kick_users(self, evt: MessageEvent) -> None:
|
||||||
await evt.mark_read()
|
await evt.mark_read()
|
||||||
|
if evt.sender in self.config["admins"]:
|
||||||
msg = await evt.respond("starting the purge...")
|
msg = await evt.respond("starting the purge...")
|
||||||
report = await self.generate_report()
|
report = await self.generate_report()
|
||||||
purgeable = report['kick_inactive']
|
purgeable = report['kick_inactive']
|
||||||
@ -208,7 +209,6 @@ class KickBot(Plugin):
|
|||||||
error_list[user] = []
|
error_list[user] = []
|
||||||
error_list[user].append(room)
|
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 \
|
||||||
recorded:<p><code>{error_list}</code></p>".format(purge_list=purge_list, error_list=error_list)
|
recorded:<p><code>{error_list}</code></p>".format(purge_list=purge_list, error_list=error_list)
|
||||||
await evt.respond(results, allow_html=True, edits=msg)
|
await evt.respond(results, allow_html=True, edits=msg)
|
||||||
@ -216,6 +216,10 @@ class KickBot(Plugin):
|
|||||||
# sync our database after we've made changes to room memberships
|
# sync our database after we've made changes to room memberships
|
||||||
await self.do_sync()
|
await self.do_sync()
|
||||||
|
|
||||||
|
else:
|
||||||
|
await evt.reply("lol you don't have permission to do that")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#need to somehow regularly fetch and update the list of room ids that are associated with a given space
|
#need to somehow regularly fetch and update the list of room ids that are associated with a given space
|
||||||
|
Loading…
Reference in New Issue
Block a user