(sender, message_info, **kwargs)
处理关注,取关
处理关注,取关
处理关注 取关
def handle_subscribe_events(sender, message_info, **kwargs):
    """处理关注,取关"""
    message = message_info.message
    if isinstance(message, BaseEvent):
        # 关注事件
        if message.event in ("subscribe", "subscribe_scan"):
            # 首次订阅
            first_subscribe = message_info.local_user.subscribe is None
            message_info.local_user.first_subscribe = first_subscribe
            message_info.local_user.subscribe = True
            message_info.local_user.subscribe_time = time.time()
            message_info.local_user.save()

        # 取关事件
        if message.event == "unsubscribe":
            message_info.local_user.subscribe = False
            message_info.local_user.save()
def handle_subscribe_events ( sender , message_info , * * kwargs ) : message = message_info . message if isinstance ( message , BaseEvent ) : # 关注事件 if message . event in ( "subscribe" , "subscribe_scan" ) : # 首次订阅 first_subscribe = message_info . local_user . subscribe is None message_info . local_user . first_subscribe = first_subscribe message_info . local_user . subscribe = True message_info . local_user . subscribe_time = time . time ( ) message_info . local_user . save ( ) # 取关事件 if message . event == "unsubscribe" : message_info . local_user . subscribe = False message_info . local_user . save ( )