0.2.4 • Published 3 months ago

koice v0.2.4

Weekly downloads
-
License
MIT
Repository
github
Last release
3 months ago

Before using this package, you confirm you understand by using this package, you are violating

Your KOOK account could face penalty including, but not limited to,

  • restriction to the access of developer tools and resources
  • suspension of user account

Use this package at your own risk. No warranties are provided.


import Koice from 'koice';

You must have ffmpeg in your PATH, or you can specify one

const client = new Koice('Your KOOK bot token');
// const client = new Koice('Your KOOK bot token', '/path/to/your/ffmpeg/binary');

Connect to WebSocket and retrive RTP URL.

client.connectWebSocket("8403799012661514");

Start streaming with path to a file or a stream.Readable;

import * as fs from 'fs';
const stream = fs.createReadStream('/path/to/music/file');
await client.startStream(stream);

or

await client.startStream('/path/to/music/file');

You can also start a ZeroMQ server to be able to stream different files without disconnecting. You can do that by invoking Koice.startServer() first, then start streaming.

await client.startServer();
await client.startStream('/path/to/music/file');

And you can also close the ZeroMQ server without stopping the stream, to switch voice channel without streaming again.

import * as fs from 'fs';

const stream = fs.createReadStream('/path/to/music/file');

client.connectWebSocket("8591468140337193");
await client.startServer();

await client.startStream(stream);

await delay(1000);

await client.closeServer();
await client.disconnectWebSocket();

client.connectWebSocket("1586400722913705");
await client.startServer();

You can refer to kook-arisa for usage of this package in real world application.


© 2022-2023 Hexona, Koice.js and kook-arisa, released under the MIT license.

0.2.4

3 months ago

0.1.12

8 months ago

0.1.13

8 months ago

0.2.1

8 months ago

0.2.0

8 months ago

0.2.3

8 months ago

0.2.2

8 months ago

0.1.11

1 year ago

0.1.10

1 year ago

0.1.9

1 year ago

0.1.8

1 year ago

0.1.7

1 year ago

0.1.6

1 year ago

0.1.5

1 year ago

0.1.4

1 year ago

0.1.3

1 year ago

0.1.2

1 year ago

0.1.1

1 year ago

0.1.0

1 year ago