mirror of
https://github.com/TeamPGM/PagerMaid_Plugins_Pyro.git
synced 2024-11-16 07:05:24 +00:00
voice_only_contact 仅联系人可以发送语音消息
This commit is contained in:
parent
45d4ad0df0
commit
2b281e3f53
10
list.json
10
list.json
@ -319,6 +319,16 @@
|
||||
"supported": true,
|
||||
"des-short": "关键词回复。",
|
||||
"des": "关键词回复。\n指令:,keyword"
|
||||
},
|
||||
{
|
||||
"name": "voice_only_contact",
|
||||
"version": "1.0",
|
||||
"section": "chat",
|
||||
"maintainer": "xtaodada",
|
||||
"size": "0.4 kb",
|
||||
"supported": true,
|
||||
"des-short": "仅联系人可以发送语音消息给我。",
|
||||
"des": "仅联系人可以发送语音消息给我。"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
14
voice_only_contact/main.py
Normal file
14
voice_only_contact/main.py
Normal file
@ -0,0 +1,14 @@
|
||||
import contextlib
|
||||
|
||||
from pyrogram import filters
|
||||
|
||||
from pagermaid.listener import raw_listener
|
||||
from pagermaid.single_utils import Message
|
||||
|
||||
|
||||
@raw_listener(filters.private & filters.voice & filters.incoming)
|
||||
async def voice_only_contact(message: Message):
|
||||
with contextlib.suppress(Exception):
|
||||
if message.from_user.is_contact:
|
||||
return
|
||||
await message.delete()
|
Loading…
Reference in New Issue
Block a user