nyxlink 0.1.0-dev.1 → 0.1.0-dev.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +53 -43
- package/package.json +1 -5
package/README.md
CHANGED
|
@@ -1,73 +1,83 @@
|
|
|
1
|
-
<
|
|
1
|
+
<p align="center">
|
|
2
|
+
<img src="https://raw.githubusercontent.com/melodiabl/NyxLink/v0.1.0-dev.2/assets/nyxlink_banner.png" alt="NyxLink" width="100%">
|
|
3
|
+
</p>
|
|
2
4
|
|
|
3
5
|
# NyxLink
|
|
4
6
|
|
|
5
|
-
Cliente de
|
|
7
|
+
Cliente de **Lavalink v4 y NodeLink** para bots de Discord, escrito en TypeScript y disponible para JavaScript y TypeScript.
|
|
6
8
|
|
|
7
|
-
|
|
9
|
+
[Paquete npm](https://www.npmjs.com/package/nyxlink) · [GitHub](https://github.com/melodiabl/NyxLink) · [Reportar un problema](https://github.com/melodiabl/NyxLink/issues)
|
|
8
10
|
|
|
9
|
-
## Instalación
|
|
11
|
+
## Instalación
|
|
12
|
+
|
|
13
|
+
Requiere **Node.js 22.12 o superior**. Versión de desarrollo actual: **0.1.0-dev.2**.
|
|
10
14
|
|
|
11
15
|
```sh
|
|
12
16
|
npm install nyxlink@dev
|
|
13
|
-
# Versión exacta:
|
|
14
|
-
npm install nyxlink@0.1.0-dev.1
|
|
15
17
|
```
|
|
16
18
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
## Desarrollo
|
|
20
|
-
|
|
21
|
-
Requiere Node.js 22.12+ o 24 y pnpm 10.34.5.
|
|
19
|
+
Para fijar la versión:
|
|
22
20
|
|
|
23
21
|
```sh
|
|
24
|
-
|
|
25
|
-
cd NyxLink
|
|
26
|
-
corepack pnpm install --frozen-lockfile
|
|
27
|
-
pnpm run typecheck
|
|
28
|
-
pnpm test
|
|
29
|
-
pnpm run test:types
|
|
30
|
-
pnpm run pack:check
|
|
22
|
+
npm install nyxlink@0.1.0-dev.2
|
|
31
23
|
```
|
|
32
24
|
|
|
33
|
-
|
|
25
|
+
## Uso con Discord.js
|
|
34
26
|
|
|
35
|
-
|
|
27
|
+
El ejemplo utiliza Discord.js 14. Instálalo en tu bot con `npm install discord.js` y configura `DISCORD_TOKEN` y `AUDIO_NODE_PASSWORD` en tu entorno.
|
|
36
28
|
|
|
37
|
-
|
|
29
|
+
```js
|
|
30
|
+
const { Client, GatewayIntentBits } = require('discord.js');
|
|
31
|
+
const { Manager, Connectors } = require('nyxlink');
|
|
38
32
|
|
|
39
|
-
|
|
33
|
+
const client = new Client({
|
|
34
|
+
intents: [GatewayIntentBits.Guilds, GatewayIntentBits.GuildVoiceStates],
|
|
35
|
+
});
|
|
40
36
|
|
|
41
|
-
|
|
37
|
+
const manager = new Manager({
|
|
38
|
+
nodes: [{
|
|
39
|
+
identifier: 'principal',
|
|
40
|
+
host: process.env.AUDIO_NODE_HOST ?? '127.0.0.1',
|
|
41
|
+
port: Number(process.env.AUDIO_NODE_PORT ?? 2333),
|
|
42
|
+
password: process.env.AUDIO_NODE_PASSWORD,
|
|
43
|
+
secure: false,
|
|
44
|
+
}],
|
|
45
|
+
options: { database: { type: 'memory' }, resume: false },
|
|
46
|
+
});
|
|
42
47
|
|
|
43
|
-
|
|
48
|
+
manager.use(new Connectors.DiscordJs(), client);
|
|
49
|
+
manager.on('nodeReady', node => console.log(`Nodo conectado: ${node.identifier}`));
|
|
50
|
+
manager.on('nodeError', (_node, error) => console.error(error.message));
|
|
44
51
|
|
|
45
|
-
|
|
52
|
+
client.login(process.env.DISCORD_TOKEN);
|
|
53
|
+
```
|
|
46
54
|
|
|
47
|
-
|
|
55
|
+
Espera el evento `nodeReady` antes de buscar o reproducir pistas. Los ejemplos completos de búsqueda, cola y cierre están en [JavaScript](examples/discordjs.cjs) y [TypeScript](examples/discordjs.ts).
|
|
48
56
|
|
|
49
|
-
##
|
|
57
|
+
## API principal
|
|
50
58
|
|
|
51
|
-
|
|
59
|
+
- `manager.search({ query, requester })`: buscar pistas.
|
|
60
|
+
- `manager.players.create({ guildId, voiceChannelId })`: crear un reproductor.
|
|
61
|
+
- `player.queue.add(track)`: añadir una pista a la cola.
|
|
62
|
+
- `await player.play()`: iniciar la reproducción; devuelve si el backend aceptó la operación.
|
|
63
|
+
- `await player.stop()`: detener la reproducción.
|
|
64
|
+
- `await player.setVolumeAsync(50)`: cambiar el volumen esperando la respuesta del backend.
|
|
65
|
+
- `await manager.shutdown()`: cerrar los recursos de NyxLink.
|
|
52
66
|
|
|
53
|
-
|
|
67
|
+
## Desarrollo
|
|
54
68
|
|
|
55
69
|
```sh
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
70
|
+
git clone --branch dev https://github.com/melodiabl/NyxLink.git
|
|
71
|
+
cd NyxLink
|
|
72
|
+
corepack pnpm install --frozen-lockfile
|
|
73
|
+
pnpm run build
|
|
74
|
+
pnpm test
|
|
75
|
+
pnpm run test:types
|
|
76
|
+
pnpm run test:package
|
|
59
77
|
```
|
|
60
78
|
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
## Pistas, almacenamiento y voz
|
|
64
|
-
|
|
65
|
-
La [tercera entrega](https://github.com/melodiabl/NyxLink/blob/v0.1.0-dev.1/docs/tracks-storage-voice.md) añade resolución de pistas en el backend de destino, snapshots con metadatos, un contrato StorageAdapter y coordinación del gateway de voz con protección frente a respuestas obsoletas. Las firmas heredadas se conservan y las pruebas no conectan bots de Discord.
|
|
66
|
-
|
|
67
|
-
## Estabilidad y cierre
|
|
68
|
-
|
|
69
|
-
La [cuarta entrega](https://github.com/melodiabl/NyxLink/blob/v0.1.0-dev.1/docs/stability.md) añade `await manager.shutdown()`, limpieza de snapshots/pings y mediciones reproducibles con `pnpm run bench` y `pnpm run test:endurance -- 600`. La [preparación de prerelease](https://github.com/melodiabl/NyxLink/blob/v0.1.0-dev.1/docs/release-readiness.md) enumera las verificaciones pendientes; la publicación de desarrollo no certifica esas funciones.
|
|
79
|
+
`src/` contiene el código TypeScript. `dist/` contiene el JavaScript compilado, las declaraciones de tipos y los mapas de código; se genera con `pnpm run build` y es la entrada del paquete npm. `tests/`, `scripts/` y `.github/` contienen las pruebas y su automatización.
|
|
70
80
|
|
|
71
|
-
## Licencia
|
|
81
|
+
## Licencia
|
|
72
82
|
|
|
73
|
-
|
|
83
|
+
Mantenido por [melodiabl](https://github.com/melodiabl). NyxLink deriva de Moonlink.js, de 1Lucas1.apk y sus colaboradores, y conserva la licencia [OSL-3.0](LICENSE) y los avisos de origen.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nyxlink",
|
|
3
|
-
"version": "0.1.0-dev.
|
|
3
|
+
"version": "0.1.0-dev.2",
|
|
4
4
|
"description": "NyxLink — Lavalink v4 and NodeLink client for Discord bots (development)",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"nyxlink",
|
|
@@ -16,10 +16,8 @@
|
|
|
16
16
|
"scripts": {
|
|
17
17
|
"dev": "tsc --watch",
|
|
18
18
|
"build": "node -e \"require('fs').rmSync('dist', { recursive: true, force: true })\" && tsc",
|
|
19
|
-
"start": "pnpm run build && pnpm run test:bot",
|
|
20
19
|
"test": "node --test tests/*.test.cjs",
|
|
21
20
|
"pretest": "pnpm run build",
|
|
22
|
-
"test:bot": "node test-bot/index.js",
|
|
23
21
|
"typecheck": "tsc --noEmit",
|
|
24
22
|
"test:types": "tsc --noEmit --strict --skipLibCheck --target ES2022 --module commonjs --moduleResolution node tests/types/public-api.ts",
|
|
25
23
|
"pack:check": "node scripts/check-package.cjs",
|
|
@@ -28,7 +26,6 @@
|
|
|
28
26
|
"test:endurance": "pnpm run build && node scripts/endurance.cjs",
|
|
29
27
|
"test:package": "pnpm run build && node scripts/test-package.cjs",
|
|
30
28
|
"test:extensions": "pnpm run build && node scripts/test-extensions.cjs",
|
|
31
|
-
"docs:api": "pnpm run build && node scripts/generate-api.cjs",
|
|
32
29
|
"test:coverage": "pnpm run build && node --test --experimental-test-coverage --test-coverage-exclude='tests/**' tests/*.test.cjs"
|
|
33
30
|
},
|
|
34
31
|
"homepage": "https://github.com/melodiabl/NyxLink#readme",
|
|
@@ -49,7 +46,6 @@
|
|
|
49
46
|
"devDependencies": {
|
|
50
47
|
"@types/node": "^24.10.0",
|
|
51
48
|
"discord.js": "^14.25.1",
|
|
52
|
-
"dotenv": "^17.2.3",
|
|
53
49
|
"typescript": "^5.9.3"
|
|
54
50
|
},
|
|
55
51
|
"private": false,
|