From c0cb54653fa1798ebace10580e1355ddf9e16901 Mon Sep 17 00:00:00 2001 From: xtaodada Date: Sun, 11 Jul 2021 15:25:01 +0800 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20listusernames=20=E5=88=97=E5=87=BA?= =?UTF-8?q?=E6=89=80=E6=9C=89=E5=B1=9E=E4=BA=8E=E8=87=AA=E5=B7=B1=E7=9A=84?= =?UTF-8?q?=E5=85=AC=E5=BC=80=E7=BE=A4=E7=BB=84/=E9=A2=91=E9=81=93?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- list.json | 10 ++++++++++ listusernames.py | 17 +++++++++++++++++ 2 files changed, 27 insertions(+) create mode 100644 listusernames.py diff --git a/list.json b/list.json index 193ad23..c5fc45c 100644 --- a/list.json +++ b/list.json @@ -559,6 +559,16 @@ "supported": true, "des-short": "图片转贴纸", "des": "把别人发的图片转换成贴纸(只支持静态)。命令:pic2sticker 。" + }, + { + "name": "listusernames", + "version": "1.0", + "section": "daily", + "maintainer": "xtaodada", + "size": "0.7 kb", + "supported": true, + "des-short": "列出所有属于自己的公开群组/频道。", + "des": "列出所有属于自己的公开群组/频道。命令:listusernames 。" } ] } diff --git a/listusernames.py b/listusernames.py new file mode 100644 index 0000000..31080f0 --- /dev/null +++ b/listusernames.py @@ -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)