add commands to only list inactive, purgable, and ignored users for less output
This commit is contained in:
+63
-1
@@ -1235,7 +1235,7 @@ class CommunityBot(Plugin):
|
|||||||
await evt.respond(f"{e}")
|
await evt.respond(f"{e}")
|
||||||
|
|
||||||
@community.subcommand(
|
@community.subcommand(
|
||||||
"report", help="generate a list of matrix IDs that have been inactive"
|
"report", help="generate a full list of activity tracking status"
|
||||||
)
|
)
|
||||||
async def get_report(self, evt: MessageEvent) -> None:
|
async def get_report(self, evt: MessageEvent) -> None:
|
||||||
if not await self.user_permitted(evt.sender):
|
if not await self.user_permitted(evt.sender):
|
||||||
@@ -1259,6 +1259,68 @@ class CommunityBot(Plugin):
|
|||||||
allow_html=True,
|
allow_html=True,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@community.subcommand(
|
||||||
|
"inactive", help="generate a list of mxids who have been inactive"
|
||||||
|
)
|
||||||
|
async def get_inactive_report(self, evt: MessageEvent) -> None:
|
||||||
|
if not await self.user_permitted(evt.sender):
|
||||||
|
await evt.reply("You don't have permission to use this command")
|
||||||
|
return
|
||||||
|
|
||||||
|
if not self.config["track_users"]:
|
||||||
|
await evt.reply("user tracking is disabled")
|
||||||
|
return
|
||||||
|
|
||||||
|
sync_results = await self.do_sync()
|
||||||
|
report = await self.generate_report()
|
||||||
|
await evt.respond(
|
||||||
|
f"<p><b>Users inactive for between {self.config['warn_threshold_days']} and \
|
||||||
|
{self.config['kick_threshold_days']} days:</b><br /> \
|
||||||
|
{'<br />'.join(report['warn_inactive'])} <br /></p>",
|
||||||
|
allow_html=True,
|
||||||
|
)
|
||||||
|
|
||||||
|
@community.subcommand(
|
||||||
|
"purgable", help="generate a list of matrix IDs that have been inactive long enough to be purged"
|
||||||
|
)
|
||||||
|
async def get_purgable_report(self, evt: MessageEvent) -> None:
|
||||||
|
if not await self.user_permitted(evt.sender):
|
||||||
|
await evt.reply("You don't have permission to use this command")
|
||||||
|
return
|
||||||
|
|
||||||
|
if not self.config["track_users"]:
|
||||||
|
await evt.reply("user tracking is disabled")
|
||||||
|
return
|
||||||
|
|
||||||
|
sync_results = await self.do_sync()
|
||||||
|
report = await self.generate_report()
|
||||||
|
await evt.respond(
|
||||||
|
f"<p><b>Users inactive for at least {self.config['kick_threshold_days']} days:</b><br /> \
|
||||||
|
{'<br />'.join(report['kick_inactive'])} <br /></p>",
|
||||||
|
allow_html=True,
|
||||||
|
)
|
||||||
|
|
||||||
|
@community.subcommand(
|
||||||
|
"ignored", help="generate a list of matrix IDs that have activity tracking disabled"
|
||||||
|
)
|
||||||
|
async def get_ignored_report(self, evt: MessageEvent) -> None:
|
||||||
|
if not await self.user_permitted(evt.sender):
|
||||||
|
await evt.reply("You don't have permission to use this command")
|
||||||
|
return
|
||||||
|
|
||||||
|
if not self.config["track_users"]:
|
||||||
|
await evt.reply("user tracking is disabled")
|
||||||
|
return
|
||||||
|
|
||||||
|
sync_results = await self.do_sync()
|
||||||
|
report = await self.generate_report()
|
||||||
|
await evt.respond(
|
||||||
|
f"<p><b>Ignored users:</b><br /> \
|
||||||
|
{'<br />'.join(report['ignored'])}</p>",
|
||||||
|
allow_html=True,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
@community.subcommand("purge", help="kick users for excessive inactivity")
|
@community.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()
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
maubot: 0.1.0
|
maubot: 0.1.0
|
||||||
id: org.jobmachine.communitybot
|
id: org.jobmachine.communitybot
|
||||||
version: 0.2.6
|
version: 0.2.7
|
||||||
license: MIT
|
license: MIT
|
||||||
modules:
|
modules:
|
||||||
- community
|
- community
|
||||||
|
|||||||
Reference in New Issue
Block a user