From 4f3d6aa75e8e7dd9a954c017833b8bb75271edf9 Mon Sep 17 00:00:00 2001 From: Pentacene Date: Mon, 17 May 2021 10:17:18 +0800 Subject: [PATCH 1/2] =?UTF-8?q?AutoReplySticker=20v1.21=20=E4=B8=8D?= =?UTF-8?q?=E5=93=8D=E5=BA=94=E6=9C=BA=E5=99=A8=E4=BA=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 3 +++ autoreplysticker.py | 2 ++ list.json | 2 +- 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index efeddfc..1ff4a37 100644 --- a/.gitignore +++ b/.gitignore @@ -130,3 +130,6 @@ dmypy.json # Pyre type checker .pyre/ + +# vscode +.vscode/ \ No newline at end of file diff --git a/autoreplysticker.py b/autoreplysticker.py index 334670c..6b2e527 100644 --- a/autoreplysticker.py +++ b/autoreplysticker.py @@ -223,6 +223,8 @@ async def process_message(context): return if str(context.sender.id) in _whitelist: return + if context.sender.bot: + return except: pass diff --git a/list.json b/list.json index 5f6d06e..3533554 100644 --- a/list.json +++ b/list.json @@ -362,7 +362,7 @@ }, { "name": "autoreplysticker", - "version": "1.20", + "version": "1.21", "section": "chat", "maintainer": "Pentacene", "size": "12 kb", From 23ccca4a207d81969a2ea90379216c2922a4a76b Mon Sep 17 00:00:00 2001 From: Pentacene Date: Mon, 17 May 2021 10:19:40 +0800 Subject: [PATCH 2/2] =?UTF-8?q?DeleteMsgsFromGrps=20v1.00=20|=20=E5=88=A0?= =?UTF-8?q?=E9=99=A4=E6=89=80=E6=9C=89=E7=BE=A4=E5=86=85=E6=B6=88=E6=81=AF?= =?UTF-8?q?=E6=88=96=E6=89=80=E6=9C=89=E4=B8=8E=E4=BB=96=E4=BA=BA=E5=AF=B9?= =?UTF-8?q?=E8=AF=9D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- deletemsgsfromgrps.py | 53 +++++++++++++++++++++++++++++++++++++++++++ list.json | 10 ++++++++ 2 files changed, 63 insertions(+) create mode 100644 deletemsgsfromgrps.py diff --git a/deletemsgsfromgrps.py b/deletemsgsfromgrps.py new file mode 100644 index 0000000..24bb0f4 --- /dev/null +++ b/deletemsgsfromgrps.py @@ -0,0 +1,53 @@ +""" Pagermaid plugin delete messages from groups """ +# ______ _ +# | ___ \ | | +# | |_/ /__ _ __ | |_ __ _ ___ ___ _ __ ___ +# | __/ _ \ '_ \| __/ _` |/ __/ _ \ '_ \ / _ \ +# | | | __/ | | | || (_| | (_| __/ | | | __/ +# \_| \___|_| |_|\__\__,_|\___\___|_| |_|\___| +# + +from asyncio import sleep +from telethon.tl.custom.message import Message +from pagermaid.listener import listener + +@listener(is_plugin=True, outgoing=True, command="dmfg") +async def dmfg(context: Message) -> None: + if len(context.parameter) == 0: + await context.edit('您没有输入参数.\n`-dmfg group` 删除所有群内发言\n`-dmfg private` 删除所有与人的对话消息') + return + if context.parameter[0] == 'group': + await context.edit('准备中...') + count = 1000000 + count_buffer = 0 + await context.edit('执行中...') + async for dialog in context.client.iter_dialogs(): + if dialog.is_channel and not dialog.is_group: + continue + if dialog.id > 0: + continue + async for message in context.client.iter_messages(dialog.id, from_user="me"): + if count_buffer == count: + break + await message.delete() + count_buffer += 1 + await context.edit('成功!') + await sleep(5) + await context.delete() + elif context.parameter[0] == 'private': + await context.edit('准备中...') + count = 1000000 + count_buffer = 0 + await context.edit('执行中...') + async for dialog in context.client.iter_dialogs(): + if dialog.id > 0: + async for message in context.client.iter_messages(dialog.id, from_user="me"): + if count_buffer == count: + break + await message.delete() + count_buffer += 1 + await context.edit('成功!') + await sleep(5) + await context.delete() + else: + await context.edit('您输入的参数错误.\n`-dmfg group` 删除所有群内发言\n`-dmfg private` 删除所有与人的对话消息') diff --git a/list.json b/list.json index 3533554..09554ea 100644 --- a/list.json +++ b/list.json @@ -370,6 +370,16 @@ "des-short": "自动回复sticker", "des": "-ars" }, + { + "name": "deletemsgsfromgrps", + "version": "1.00", + "section": "chat", + "maintainer": "Pentacene", + "size": "4 kb", + "supported": true, + "des-short": "删除所有群内消息或所有与他人对话", + "des": "-dmfg" + }, { "name": "keyword", "version": "2.631",