mirror of
https://github.com/TeamPGM/PagerMaid_Plugins_Pyro.git
synced 2024-11-16 07:05:24 +00:00
moyu 禁止普通成员操作订阅/退订功能
This commit is contained in:
parent
ea159b1aa1
commit
1b663ec5e1
@ -32,7 +32,7 @@
|
||||
},
|
||||
{
|
||||
"name": "moyu",
|
||||
"version": "1.0",
|
||||
"version": "1.001",
|
||||
"section": "chat",
|
||||
"maintainer": "xtaodada",
|
||||
"size": "3.0 kb",
|
||||
|
27
moyu/main.py
27
moyu/main.py
@ -3,10 +3,13 @@
|
||||
from os import sep
|
||||
|
||||
from pyrogram import Client
|
||||
from pyrogram.enums.parse_mode import ParseMode
|
||||
from pagermaid import scheduler
|
||||
from pagermaid import bot
|
||||
from pagermaid.group_manager import enforce_permission
|
||||
from pagermaid.listener import listener
|
||||
from pagermaid.utils import client, Message
|
||||
from pagermaid.modules.help import from_msg_get_sudo_uid
|
||||
from pagermaid.utils import client, Message, from_self, edit_delete
|
||||
from pagermaid.sub_utils import Sub
|
||||
|
||||
moyu_sub = Sub("moyu")
|
||||
@ -55,12 +58,18 @@ async def moyu(_: Client, message: Message):
|
||||
await message.safe_delete()
|
||||
await push_moyu(message.chat.id)
|
||||
elif message.arguments == "订阅":
|
||||
if moyu_sub.check_id(message.chat.id):
|
||||
return await message.edit("你已经订阅了摸鱼日历")
|
||||
moyu_sub.add_id(message.chat.id)
|
||||
await message.edit("你已经成功订阅了摸鱼日历")
|
||||
if from_self(message) or enforce_permission(from_msg_get_sudo_uid(message), "modules.manage_subs"):
|
||||
if moyu_sub.check_id(message.chat.id):
|
||||
return await edit_delete(message, "❌ 你已经订阅了摸鱼日历", parse_mode=ParseMode.HTML)
|
||||
moyu_sub.add_id(message.chat.id)
|
||||
await message.edit("你已经成功订阅了摸鱼日历")
|
||||
else:
|
||||
await edit_delete(message, "❌ 权限不足,无法订阅摸鱼日历", parse_mode=ParseMode.HTML)
|
||||
elif message.arguments == "退订":
|
||||
if not moyu_sub.check_id(message.chat.id):
|
||||
return await message.edit("你还没有订阅摸鱼日历")
|
||||
moyu_sub.del_id(message.chat.id)
|
||||
await message.edit("你已经成功退订了摸鱼日历")
|
||||
if from_self(message) or enforce_permission(from_msg_get_sudo_uid(message), "modules.manage_subs"):
|
||||
if not moyu_sub.check_id(message.chat.id):
|
||||
return await edit_delete(message, "❌ 你还没有订阅摸鱼日历", parse_mode=ParseMode.HTML)
|
||||
moyu_sub.del_id(message.chat.id)
|
||||
await message.edit("你已经成功退订了摸鱼日历")
|
||||
else:
|
||||
await edit_delete(message, "❌ 权限不足,无法退订摸鱼日历", parse_mode=ParseMode.HTML)
|
||||
|
Loading…
Reference in New Issue
Block a user