diff --git a/forcesubscribe.py b/forcesubscribe.py index 0b4422c..0bb2eea 100644 --- a/forcesubscribe.py +++ b/forcesubscribe.py @@ -5,6 +5,7 @@ from asyncio import sleep from telethon.events.chataction import ChatAction from telethon.tl.custom.message import Message from telethon.tl.functions.channels import GetParticipantRequest +from telethon.tl.types import ChannelParticipantsAdmins from telethon.errors.rpcerrorlist import UserNotParticipantError, ChatAdminRequiredError from telethon import events @@ -108,5 +109,10 @@ async def force_sub(context): await context.edit(lang('ghost_e_mark')) return sub_channel = context.parameter[0].replace('@', '') + try: + await context.client.get_participants(sub_channel, filter=ChannelParticipantsAdmins) + except: + await context.edit(f'设置失败:不是频道 @{sub_channel} 的管理员。') + return redis.set(f"sub.chat_id.{context.chat_id}", sub_channel) await context.edit(f'已设置当前群组强制需要关注频道的频道为: @{sub_channel} 。') diff --git a/list.json b/list.json index cde4108..c897392 100644 --- a/list.json +++ b/list.json @@ -612,7 +612,7 @@ }, { "name": "forcesubscribe", - "version": "1.03", + "version": "1.04", "section": "daily", "maintainer": "xtaodada", "size": "4.2 kb",