22
33from aiogram .types import Message
44
5+ from config import config
6+
57async def handle_whitelist_command (message : Message ):
68 """处理白名单命令"""
79 chat_id = message .chat .id
10+ if config .is_feature_enabled ('anti_anonymous' , chat_id ) is False :
11+ return
812 try :
913 channel_id = int (message .text .split (' ' )[1 ])
1014 except (IndexError , ValueError ):
@@ -23,6 +27,8 @@ async def handle_whitelist_command(message: Message):
2327async def handle_remove_whitelist_command (message : Message ):
2428 """处理移除白名单命令"""
2529 chat_id = message .chat .id
30+ if config .is_feature_enabled ('anti_anonymous' , chat_id ) is False :
31+ return
2632 try :
2733 channel_id = int (message .text .split (' ' )[1 ])
2834 except (IndexError , ValueError ):
@@ -45,6 +51,8 @@ async def handle_enable_also_ban_command(message: Message):
4551 await message .reply ("用法: /also_auto_ban_channel [on|off]" )
4652 return
4753 chat_id = message .chat .id
54+ if config .is_feature_enabled ('anti_anonymous' , chat_id ) is False :
55+ return
4856 member = await message .chat .get_member (message .from_user .id )
4957 is_group_anonymous_admin = message .sender_chat and message .sender_chat .id == message .chat .id
5058 if not member .status in ['administrator' , 'creator' ] and not is_group_anonymous_admin :
@@ -61,6 +69,8 @@ async def handle_enable_also_ban_command(message: Message):
6169async def handle_anonymous_channel_msgs (message : Message ):
6270 """处理来自匿名频道的消息"""
6371 chat_id = message .chat .id
72+ if config .is_feature_enabled ('anti_anonymous' , chat_id ) is False :
73+ return
6474 channel_id = message .sender_chat .id if message .sender_chat else None
6575 is_from_binded_channel = message .is_automatic_forward
6676 is_group_anonymous_admin = message .sender_chat and message .sender_chat .id == message .chat .id
0 commit comments