telegram获取文件时连接器返回ERR_INVALID_URL

求助files.endpoint应该如何设置?
我的bot收到图片时连接器报错,log附在最下面


我用console.log简单检查了报错发生在我处理文件的代码之前,我感觉应该不是我的问题,关于适配器我使用了polling模式,没有启用files.local和files.server(其实有截很多图,论坛新用户只能发一张图片所以只能文字描述一下了)

其中files.endpoint我尝试了以下url均报一样的错:

https://api.telegram.org
https://api.telegram.org/file
https://api.telegram.org/file/bot{我的token}
https://api.telegram.org/file/bot{我的token}/

查阅了适配器的文档仍未见file.endpoint具体应如何设置,请问各位是我设置的endpoint的问题吗?应该如何调整?
log如此:

2025-02-24 19:15:13 [W] telegram get file error TypeError [ERR_INVALID_URL]: Invalid URL     at __node_internal_captureLargerStackTrace (node:internal/errors:496:5)     at new NodeError (node:internal/errors:405:5)     at new URL (node:internal/url:611:13) at Proxy.<anonymous> (C:\Users\26340\Desktop\bot\broken_snow\node_modules\@satorijs\core\lib\index.cjs:846:19) at Object.apply (C:\Users\26340\Desktop\bot\broken_snow\node_modules\@cordisjs\core\src\reflect.ts:221:23) at Proxy.dispatch (C:\Users\26340\Desktop\bot\broken_snow\node_modules\@cordisjs\core\src\events.ts:141:27) at dispatch.next (<anonymous>) at Async-from-Sync Iterator.next (<anonymous>) at Proxy.serial (C:\Users\26340\Desktop\bot\broken_snow\node_modules\@cordisjs\core\src\events.ts:154:22) at Proxy.file (C:\Users\26340\Desktop\bot\broken_snow\node_modules\@cordisjs\plugin-http\lib\index.cjs:400:33) at Object.apply (C:\Users\26340\Desktop\bot\broken_snow\node_modules\@cordisjs\core\src\utils.ts:141:40) at Object.apply (C:\Users\26340\Desktop\bot\broken_snow\node_modules\@cordisjs\core\src\utils.ts:141:40) at _TelegramBot.$getFile (C:\Users\26340\Desktop\bot\broken_snow\node_modules\@satorijs\adapter-telegram\lib\index.cjs:935:30) at _TelegramBot.$getFileFromPath (C:\Users\26340\Desktop\bot\broken_snow\node_modules\@satorijs\adapter-telegram\lib\index.cjs:950:37) at _TelegramBot.$getFileFromId (C:\Users\26340\Desktop\bot\broken_snow\node_modules\@satorijs\adapter-telegram\lib\index.cjs:941:25)     at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async decodeMessage (C:\Users\26340\Desktop\bot\broken_snow\node_modules\@satorijs\adapter-telegram\lib\index.cjs:400:45) at async handleUpdate (C:\Users\26340\Desktop\bot\broken_snow\node_modules\@satorijs\adapter-telegram\lib\index.cjs:271:7) { input: '/photos/file_2.jpg', code: 'ERR_INVALID_URL' }
2 个赞

可以参考 lgc-KoiDev/workspace@master/.yarn/patches/%40satorijs-core-npm-4.5.0-22b9079270.patch

1 个赞

我试一下!感谢

1 个赞

这个 bug 在上游已经修了,等待 Koishi 发版即可

在此期间如果等不及的话临时 patch 一下就好

1 个赞