sakarie9 / TG-EFB-QQ-Docker

QQ和Telegram的双向消息转发
GNU Affero General Public License v3.0
193 stars 17 forks source link

如何过滤加群退群消息? #8

Closed CHN-beta closed 2 years ago

CHN-beta commented 3 years ago

go-cqhttp 似乎是支持按照文本内容过滤消息的,但我不确定我理解的对不对。

如果确实可以按照上述文档过滤消息的话,文档中所述的 json 应该放到哪里呢,以及同时需要修改哪些配置文件呢?

sakarie9 commented 3 years ago
  1. 编辑gocq/config.yml,修改filter目录

    default-middlewares: &default
    access-token: ''
    # 事件过滤器文件目录
    filter: '/data/filter.json' #修改这里
  2. 新建gocq/filter.json,写入以下内容

无效配置,用楼下的 ``` { "notice_type": { ".or": [ { ".neq": "group_increase" }, { ".neq": "group_decrease" } ] } } ```

大概就可以了,如果有问题可以参考 事件 - 群成员减少 修改filter.json

gaxdel commented 2 years ago

这个规则不能过滤加群退群消息。改成下面这个规则就可以了。


{
    ".not": {
        ".or": [
            {
                "notice_type": "group_decrease"
            },
            {
                "notice_type": "group_increase"
            }
        ]
    }
}
sakarie9 commented 2 years ago

这个规则不能过滤加群退群消息。改成下面这个规则就可以了。

{
    ".not": {
        ".or": [
            {
                "notice_type": "group_decrease"
            },
            {
                "notice_type": "group_increase"
            }
        ]
    }
}

确认有效