Plugin: dc, premium

咯,你想要的bot和死号分离
This commit is contained in:
guimc233 2022-06-24 00:24:57 +08:00
parent d97f9646df
commit 238c95e9b8
3 changed files with 12 additions and 8 deletions

View File

@ -28,7 +28,7 @@ async def dc(bot: Client, context: Message):
count = await bot.get_chat_members_count(context.chat.id)
if count >= 10000 and context.arguments != "force":
return await context.edit("太...太多人了... 我会...会...会坏掉的...\n\n如果您执意要运行的的话,您可以使用指令 ,dc force")
users = bots_deleted = 0
users = bots = deleted = 0
dc_ids = {"1": 0, "2": 0, "3": 0, "4": 0, "5": 0, "failed": 0}
async for m in bot.get_chat_members(context.chat.id, limit=9999):
if not m.user.is_bot and not m.user.is_deleted:
@ -37,8 +37,10 @@ async def dc(bot: Client, context: Message):
dc_ids[str(m.user.dc_id)] += 1
except:
dc_ids["failed"] += 1
elif m.user.is_bot:
bots += 1
else:
bots_deleted += 1
deleted += 1
await context.edit(f"""DC:
> DC1用户: **{dc_ids["1"]}** 分遗产占比: **{round((dc_ids["1"]/users)*100, 2)}%**
> DC2用户: **{dc_ids["2"]}** 分遗产占比: **{round((dc_ids["2"]/users)*100, 2)}%**
@ -46,6 +48,6 @@ async def dc(bot: Client, context: Message):
> DC4用户: **{dc_ids["4"]}** 分遗产占比: **{round((dc_ids["4"]/users)*100, 2)}%**
> DC5用户: **{dc_ids["5"]}** 分遗产占比: **{round((dc_ids["5"]/users)*100, 2)}%**
> 无法获取在哪个DC的用户: **{dc_ids["failed"]}**
> 已自动过滤掉 **{bots_deleted}** Bot / 死号
> 已自动过滤掉 **{bots}** Bot, **{deleted}** 死号
{'***请注意: 由于tg限制 我们只能遍历前10k人 此次获得到的数据并不完整***' if count >= 10000 else ''}""", parse_mode = ParseMode.MARKDOWN)

View File

@ -192,7 +192,7 @@
},
{
"name": "premium",
"version": "1.004",
"version": "1.005",
"section": "chat",
"maintainer": "xiluo",
"size": "2.0 kb",
@ -212,7 +212,7 @@
},
{
"name": "dc",
"version": "1.002",
"version": "1.004",
"section": "chat",
"maintainer": "xiluo",
"size": "2.3 kb",

View File

@ -15,7 +15,7 @@ from pyrogram.enums import ChatMemberStatus, ParseMode
description="分遗产咯")
async def premium(bot: Client, context: Message):
context = await context.edit("Please wait...")
premium_users = users = admins = premium_admins = bots_deleted = 0
premium_users = users = admins = premium_admins = bots = deleted = 0
dc_ids = {"1": 0, "2": 0, "3": 0, "4": 0, "5": 0, "failed": 0}
count = await bot.get_chat_members_count(context.chat.id)
if count >= 10000 and context.arguments != "force":
@ -33,8 +33,10 @@ async def premium(bot: Client, context: Message):
premium_admins += 1
if m.status in [ChatMemberStatus.OWNER, ChatMemberStatus.ADMINISTRATOR]:
admins += 1
elif m.user.is_bot:
bots += 1
else:
bots_deleted += 1
deleted += 1
await context.edit(f"""**分遗产咯**
管理员:
@ -43,6 +45,6 @@ async def premium(bot: Client, context: Message):
用户:
> 大会员: **{premium_users}** / 总用户数: **{users}** 分遗产占比: **{round((premium_users/users)*100, 2)}%**
> 已自动过滤掉 **{bots_deleted}** Bot / 死号
> 已自动过滤掉 **{bots}** Bot, **{deleted}** 死号
{'***请注意: 由于tg限制 我们只能遍历前10k人 此次获得到的数据并不完整***' if count >= 10000 else ''}""", parse_mode = ParseMode.MARKDOWN)