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

Bug: ctx.broadcast 报错的问题 #1418

Closed
waterminer opened this issue Jun 28, 2024 · 3 comments
Closed

Bug: ctx.broadcast 报错的问题 #1418

waterminer opened this issue Jun 28, 2024 · 3 comments
Labels
bug BUG

Comments

@waterminer
Copy link

waterminer commented Jun 28, 2024

Describe the bug

broadcast无法正常推送信息并报错

Steps to reproduce

在代码中调用broadcast这个api
示例如下:

function broadcast(deliver: Deliver, message: string) {
    const temp = deliver.map(
      element => `${element.platform}:${element.guildId}`
    );
    logger.info(temp)
    ctx.broadcast(temp, message);
  }

这里的temp我用logger检查过了,输出为
['onebot:xxxxxxx']
应该是期望输出

Expected behavior

能正常广播推送信息

Screenshots

我是一个插件作者
近期发现我的插件在更新后无法正常运作
当需要广播消息的时候会在控制台出现以下报错

TypeError: this.get is not a function
                            at KoishiDatabase.getAssignedChannels (F:\TypeScript\koishi-app\node_modules\@koishijs\core\src\database.ts:192:17)
                            at KoishiDatabase.broadcast (F:\TypeScript\koishi-app\node_modules\@koishijs\core\src\database.ts:215:29)
                            at broadcast (f:\TypeScript\koishi-app\external\rsshub-koishi\src\index.ts:271:9)
                            at <anonymous> (f:\TypeScript\koishi-app\external\rsshub-koishi\src\index.ts:286:7)
                            at Array.forEach (<anonymous>)
                            at Command.broadcastNews (f:\TypeScript\koishi-app\external\rsshub-koishi\src\index.ts:285:12)
                            at Array.<anonymous> (F:\TypeScript\koishi-app\node_modules\@koishijs\core\src\command\command.ts:287:14)
                            at Command.execute (F:\TypeScript\koishi-app\node_modules\@koishijs\core\src\command\command.ts:303:22)
                            at <anonymous> (F:\TypeScript\koishi-app\node_modules\@koishijs\core\src\session.ts:446:22)
                            at Proxy.withScope (F:\TypeScript\koishi-app\node_modules\@koishijs\core\src\session.ts:343:22)

起初我以为是我的代码随着版本更新后失效,结果发现问题根源似乎是broadcast这个api导致的

Versions

System:
OS: Windows 10 10.0.19045
CPU: (8) x64 Intel(R) Core(TM) i7-9700K CPU @ 3.60GHz

Binaries:
Node: 20.11.1
npm: 10.5.0

Koishi:
Core: 4.17.9
Console: 5.29.2

Additional context

No response

@waterminer waterminer added the bug BUG label Jun 28, 2024
@ArcticFoxPro
Copy link

我也遇到了相同问题,Koishi 4.17.9。也是 boardcast 相关报错,报错信息几乎一致。

在 4.17.7 时没有此问题。

@borraken
Copy link

borraken commented Jul 8, 2024

同样的问题

@shigma shigma closed this as completed in 10e359a Jul 17, 2024
@shigma
Copy link
Member

shigma commented Jul 17, 2024

已修复,会尽快发版。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug BUG
Projects
None yet
Development

No branches or pull requests

4 participants