koishijs / koishi

Cross-platform chatbot framework made with love
https://koishi.chat
MIT License
4.53k stars 246 forks source link

Bug: 添加沙盒用户时触发的 guild-member-added 事件无视过滤器 #1470

Open DGCK81LNN opened 1 month ago

DGCK81LNN commented 1 month ago

Describe the bug

^

Steps to reproduce

  1. 创建并启用以下插件,设置过滤器:平台 等于 onebot 群组 ID 等于 123456789

    export const name = "greet"
    
    export function apply(ctx) {
      ctx.on("guild-member-added", session => {
        ctx.logger.info("aaa", session)
      })
    }
  2. 在 Koishi 控制台的“沙盒”中添加用户

  3. 2024-10-21 11:46:27 [I] greet aaa Session { id: 728, event: { user: { id: 'Dave', name: 'Dave' }, channel: { id: '#', type: 0 }, guild: { id: '#' }, timestamp: 1729482387839, selfId: 'koishi', platform: 'sandbox:pmnmowshgei', type: 'guild-member-added' }, locales: [], [Symbol(cordis.tracker)]: { associate: 'session', property: 'ctx' } }

其他平台成员加入群组的事件则可以正常被过滤。

Expected behavior

在沙盒添加用户不应该触发带上述过滤器的插件中的钩子。

Screenshots

No response

Versions

Additional context

No response