listusernames 列出所有属于自己的公开群组/频道

This commit is contained in:
xtaodada 2021-07-11 15:25:01 +08:00
parent 04f94ca8e9
commit c0cb54653f
No known key found for this signature in database
GPG Key ID: EE4DC37B55E24736
2 changed files with 27 additions and 0 deletions

View File

@ -559,6 +559,16 @@
"supported": true, "supported": true,
"des-short": "图片转贴纸", "des-short": "图片转贴纸",
"des": "把别人发的图片转换成贴纸只支持静态。命令pic2sticker 。" "des": "把别人发的图片转换成贴纸只支持静态。命令pic2sticker 。"
},
{
"name": "listusernames",
"version": "1.0",
"section": "daily",
"maintainer": "xtaodada",
"size": "0.7 kb",
"supported": true,
"des-short": "列出所有属于自己的公开群组/频道。",
"des": "列出所有属于自己的公开群组/频道。命令listusernames 。"
} }
] ]
} }

17
listusernames.py Normal file
View File

@ -0,0 +1,17 @@
from pagermaid import bot
from pagermaid.listener import listener
from pagermaid.utils import alias_command
from telethon.tl.functions.channels import GetAdminedPublicChannelsRequest
@listener(is_plugin=False, outgoing=True, command=alias_command("listusernames"),
description='列出所有属于自己的公开群组/频道。',
parameters="")
async def listusernames(context):
""" Get a list of your reserved usernames. """
await context.edit('正在获取中...')
result = await bot(GetAdminedPublicChannelsRequest())
output = "以下是属于我的所有公开群组/频道:\n\n"
for i in result.chats:
output += f"{i.title}\n@{i.username}\n\n"
await context.edit(output)