这是 Milky 协议的 Node.js SDK,提供 TypeScript 支持。
源码中使用了 Node.js 的 WebSocket API,因此需要 Node 版本高于或等于 22。如果必须在低于 22 的版本中使用,请在启动时加入 --experimental-websocket 这一 Flag。
import { MilkyClient } from '@saltify/milky-node-sdk';
const client = new MilkyClient('localhost', 3000, '/', 'your-access-token');const response = await client.callApi('get_group_info', {
group_id: 123456789,
});client.on('message_receive', (event) => {
console.log('Received event:', event);
});