mirror of
https://github.com/TeamPGM/PagerMaid_Plugins.git
synced 2024-11-22 01:15:34 +00:00
fuckmessage 删除最近 200 条消息中包含指定关键字的消息。
This commit is contained in:
parent
a968bfb0cc
commit
cb5714addd
36
fuckmessage.py
Normal file
36
fuckmessage.py
Normal file
@ -0,0 +1,36 @@
|
||||
""" Module to automate sticker deletion. """
|
||||
from pagermaid import log
|
||||
from pagermaid.listener import listener
|
||||
from pagermaid.utils import alias_command, lang
|
||||
|
||||
|
||||
@listener(is_plugin=True, outgoing=True, command=alias_command("fuckmessage"),
|
||||
description="删除最近 200 条消息中包含指定关键字的消息。",
|
||||
parameters="<关键词>")
|
||||
async def fuck_message(context):
|
||||
""" Deletes specific amount of messages in chat. """
|
||||
if not context.arguments:
|
||||
await context.edit(lang('arg_error'))
|
||||
return
|
||||
input_chat = await context.get_input_chat()
|
||||
count_buffer = 0
|
||||
count = 0
|
||||
messages = []
|
||||
async for message in context.client.iter_messages(context.chat_id):
|
||||
if count_buffer == 200:
|
||||
break
|
||||
if context.arguments in message.text:
|
||||
messages.append(message)
|
||||
count += 1
|
||||
if len(messages) > 50:
|
||||
try:
|
||||
await context.client.delete_messages(input_chat, messages)
|
||||
except Exception as e:
|
||||
await log(f'插件 fuckmessage 发生错误:\n{e}')
|
||||
count_buffer += 1
|
||||
text = f"删除了 {count} / {count_buffer} 条 消息 。"
|
||||
try:
|
||||
await context.client.delete_messages(input_chat, messages)
|
||||
except Exception as e:
|
||||
await log(f'插件 fuckmessage 发生错误:\n{e}')
|
||||
await log(text)
|
10
list.json
10
list.json
@ -649,6 +649,16 @@
|
||||
"supported": true,
|
||||
"des-short": "删除某人的消息并踢出/禁言",
|
||||
"des": "回复你要删除消息和踢的人或者要禁言的人\n指令:\n-kickanddm 直接删除消息并踢人\n-kickanddm 100 禁言100秒(tg不支持60秒以下的时间,少于60变成永久)并删除最近999条消息\n⚠️kickanddm 后面带时间的只是禁言,不带时间的直接踢。"
|
||||
},
|
||||
{
|
||||
"name": "fuckmessage",
|
||||
"version": "1.0",
|
||||
"section": "chat",
|
||||
"maintainer": "xtaodada",
|
||||
"size": "1.3 kb",
|
||||
"supported": true,
|
||||
"des-short": "删除烦人的消息",
|
||||
"des": "删除最近 200 条消息中包含指定关键字的消息。"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user