Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature]: @handler(GroupMessageReceived)事件监听无法匹配黑白名单 #1229

Open
sheetung opened this issue Mar 24, 2025 · 0 comments

Comments

@sheetung
Copy link

这是一个?

现有功能优化

详细描述

@handler(GroupNormalMessageReceived)只会给插件传递满足响应规则的消息(比如加了前缀ai 或者 / 又或者at),这个受访问控制黑白名单影响

@handler(GroupMessageReceived)不受任何控制,正常传递消息
而我又想要不需要前缀同样不需要at,但是又想要受黑白名单控制,


目前copy了bansess.py的访问控制处理过程,实现了@handler(GroupMessageReceived)跳过响应规则的情况下满足系统黑白名单规则

        found = False

        mode = self.ap.pipeline_cfg.data['access-control']['mode']

        sess_list = self.ap.pipeline_cfg.data['access-control'][mode]

        if (query.launcher_type.value == 'group' and 'group_*' in sess_list) \
            or (query.launcher_type.value == 'person' and 'person_*' in sess_list):
            found = True
        else:
            for sess in sess_list:
                if sess == f"{query.launcher_type.value}_{query.launcher_id}":
                    found = True
                    break
            
        ctn = False

        if mode == 'whitelist':
            ctn = found
        else:
            ctn = not found
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant