1
0
Fork 0
mirror of https://github.com/myned/watcher.git synced 2024-11-01 20:22:38 +00:00

Rename inactive command to limbo and filter list

This commit is contained in:
Myned 2022-07-05 17:43:56 -05:00
parent 3071543612
commit f104355a99
No known key found for this signature in database
GPG key ID: 33790F979F7A28B8

View file

@ -12,25 +12,27 @@ plugin = lightbulb.Plugin("info", default_enabled_guilds=c.config["guild"])
# Get list of inactive members # Get list of inactive members
@plugin.command @plugin.command
@lightbulb.add_checks(lightbulb.has_guild_permissions(hikari.Permissions.MANAGE_GUILD)) @lightbulb.add_checks(lightbulb.has_guild_permissions(hikari.Permissions.MANAGE_GUILD))
@lightbulb.command("inactive", "List inactive members", ephemeral=True) @lightbulb.command("limbo", "List members not in activity database", ephemeral=True)
@lightbulb.implements(lightbulb.SlashCommand) @lightbulb.implements(lightbulb.SlashCommand)
async def inactive(context): async def limbo(context):
def build(index, content): def build(index, content):
return hikari.Embed( return hikari.Embed(
title="Inactive", description=content, color=context.get_guild().get_my_member().get_top_role().color title="Limbo", description=content, color=context.get_guild().get_my_member().get_top_role().color
).set_footer(f"{len(inactive)} members") ).set_footer(f"{len(limbo)} members")
inactive = { limbo = {
snowflake: member snowflake: member
for snowflake, member in sorted( for snowflake, member in sorted(
context.get_guild().get_members().items(), key=lambda item: item[1].display_name context.get_guild().get_members().items(), key=lambda item: item[1].display_name
) )
if snowflake not in c.db if not member.is_bot
and c.config["exclude"] not in [role.id for role in member.get_roles()]
and snowflake not in c.db
} }
paginator = lightbulb.utils.EmbedPaginator() paginator = lightbulb.utils.EmbedPaginator()
paginator.set_embed_factory(build) paginator.set_embed_factory(build)
for snowflake, member in inactive.items(): for snowflake, member in limbo.items():
paginator.add_line(f"{member.mention} {snowflake}") paginator.add_line(f"{member.mention} {snowflake}")
pages = [page for page in paginator.build_pages()] pages = [page for page in paginator.build_pages()]