mirror of
https://github.com/TeamPGM/PagerMaid_Plugins.git
synced 2024-11-22 12:55:38 +00:00
Merge pull request #161 from Pentacene/master
dmfg v1.00 删除所有群内消息或所有与他人对话 | ars v1.21 与bot不反应
This commit is contained in:
commit
7b34ea074e
3
.gitignore
vendored
3
.gitignore
vendored
@ -130,3 +130,6 @@ dmypy.json
|
|||||||
|
|
||||||
# Pyre type checker
|
# Pyre type checker
|
||||||
.pyre/
|
.pyre/
|
||||||
|
|
||||||
|
# vscode
|
||||||
|
.vscode/
|
@ -223,6 +223,8 @@ async def process_message(context):
|
|||||||
return
|
return
|
||||||
if str(context.sender.id) in _whitelist:
|
if str(context.sender.id) in _whitelist:
|
||||||
return
|
return
|
||||||
|
if context.sender.bot:
|
||||||
|
return
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
53
deletemsgsfromgrps.py
Normal file
53
deletemsgsfromgrps.py
Normal file
@ -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` 删除所有与人的对话消息')
|
12
list.json
12
list.json
@ -362,7 +362,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "autoreplysticker",
|
"name": "autoreplysticker",
|
||||||
"version": "1.20",
|
"version": "1.21",
|
||||||
"section": "chat",
|
"section": "chat",
|
||||||
"maintainer": "Pentacene",
|
"maintainer": "Pentacene",
|
||||||
"size": "12 kb",
|
"size": "12 kb",
|
||||||
@ -370,6 +370,16 @@
|
|||||||
"des-short": "自动回复sticker",
|
"des-short": "自动回复sticker",
|
||||||
"des": "-ars"
|
"des": "-ars"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"name": "deletemsgsfromgrps",
|
||||||
|
"version": "1.00",
|
||||||
|
"section": "chat",
|
||||||
|
"maintainer": "Pentacene",
|
||||||
|
"size": "4 kb",
|
||||||
|
"supported": true,
|
||||||
|
"des-short": "删除所有群内消息或所有与他人对话",
|
||||||
|
"des": "-dmfg"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "keyword",
|
"name": "keyword",
|
||||||
"version": "2.631",
|
"version": "2.631",
|
||||||
|
Loading…
Reference in New Issue
Block a user