lavalink-client 2.1.3 → 2.1.4

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 CHANGED
@@ -24,7 +24,7 @@ Easy, flexible and feature-rich lavalink@v4 Client. Both for Beginners and Profi
24
24
 
25
25
  # Install
26
26
 
27
- Latest stable Version: (currently, unreleased)
27
+ Latest stable Version: **`v2.1.3`**
28
28
 
29
29
  <details><summary>👉 via NPM</summary>
30
30
 
@@ -57,7 +57,12 @@ yarn add tomato6966/lavalink-client
57
57
 
58
58
  # Documentation
59
59
 
60
- Check out the [Documentation](https://lc4.gitbook.io/lavalink-client) for **Examples**, and **__detailled__ Docs**, and to figure out **how to get started**. *note: it's not fully done yet (see the docs)*
60
+ Check out the [Documentation](https://lc4.gitbook.io/lavalink-client) | or the [TSDocumentation](https://tomato6966.github.io/lavalink-client/) for **Examples**, and **__detailled__ Docs**, and to figure out **how to get started**. *note: it's not fully done yet (see the docs)*
61
+
62
+ # Used in:
63
+
64
+ - [Betty](https://betty.cx/)
65
+ - [Mivator](https://discord.gg/5dUb7M2qCj)
61
66
 
62
67
  # Features
63
68
 
@@ -97,6 +102,91 @@ Check out the [Documentation](https://lc4.gitbook.io/lavalink-client) for **Exam
97
102
 
98
103
  - 😁 Much much more!
99
104
 
105
+ ***
106
+
107
+ # All Events:
108
+
109
+ ## On **Lavalink-Manager**:
110
+ > *Player related logs*
111
+ - `playerCreate` ➡️ `(player) => {}`
112
+ - `playerDestroy` ➡️ `(player, reason) => {}`
113
+ - `playerDisconnect` ➡️ `(player, voiceChannelId) => {}`
114
+ - `playerMove` ➡️ `(player, oldChannelId, newChannelId) => {}`
115
+ - Updating the voice channel is handled by the client automatically
116
+ - `playerSocketClosed` ➡️ `(player, payload) => {}`
117
+
118
+ > *Track / Manager related logs*
119
+ - `trackStart` ➡️ `(player, track, payload) => {}`
120
+ - `trackStuck` ➡️ `(player, track, payload) => {}`
121
+ - `trackError` ➡️ `(player, track, payload) => {}`
122
+ - `trackEnd` ➡️ `(player, track, payload) => {}`
123
+ - `queueEnd` ➡️ `(player, track, payload) => {}`
124
+ - `playerUpdate` ➡️ `(player) => {}`
125
+
126
+ ```js
127
+ client.lavalink.on("create", (node, payload) => {
128
+ console.log(`The Lavalink Node #${node.id} connected`);
129
+ });
130
+ // for all node based errors:
131
+ client.lavalink.on("error", (node, error, payload) => {
132
+ console.error(`The Lavalink Node #${node.id} errored: `, error);
133
+ console.error(`Error-Payload: `, payload)
134
+ });
135
+ ```
136
+
137
+ ## On **Node-Manager**:
138
+ - `raw` ➡️ `(node, payload) => {}`
139
+ - `disconnect` ➡️ `(node, reason) => {}`
140
+ - `connect` ➡️ `(node) => {}`
141
+ - `reconnecting` ➡️ `(node) => {}`
142
+ - `create` ➡️ `(node) => {}`
143
+ - `destroy` ➡️ `(node) => {}`
144
+ - `error` ➡️ `(node, error, payload) => {}`
145
+ - `resumed` ➡️ `(node, payload, players) => {}`
146
+ - Resuming needs to be handled manually by you *(aka add the players to the manager)*
147
+ - e.g.:
148
+ ```js
149
+ client.lavalink.nodeManager.on("create", (node, payload) => {
150
+ console.log(`The Lavalink Node #${node.id} connected`);
151
+ });
152
+ // for all node based errors:
153
+ client.lavalink.nodeManager.on("error", (node, error, payload) => {
154
+ console.error(`The Lavalink Node #${node.id} errored: `, error);
155
+ console.error(`Error-Payload: `, payload)
156
+ });
157
+ ```
158
+
159
+ ## How to log queue logs?
160
+ > When creating the manager, add the option: `queueOptions.queueChangesWatcher: new myCustomWatcher(botClient)`
161
+ > E.g:
162
+ ```js
163
+ import { QueueChangesWatcher, LavalinkManager } from "lavalink-client";
164
+
165
+ class myCustomWatcher implements QueueChangesWatcher {
166
+ constructor(client) {
167
+ this.client = client;
168
+ }
169
+ shuffled(guildId, oldStoredQueue, newStoredQueue) {
170
+ console.log(`${this.client.guilds.cache.get(guildId)?.name || guildId}: Queue got shuffled`)
171
+ }
172
+ tracksAdd(guildId, tracks, position, oldStoredQueue, newStoredQueue) {
173
+ console.log(`${this.client.guilds.cache.get(guildId)?.name || guildId}: ${tracks.length} Tracks got added into the Queue at position #${position}`);
174
+ }
175
+ tracksRemoved(guildId, tracks, position, oldStoredQueue, newStoredQueue) {
176
+ console.log(`${this.client.guilds.cache.get(guildId)?.name || guildId}: ${tracks.length} Tracks got removed from the Queue at position #${position}`);
177
+ }
178
+ }
179
+
180
+ client.lavalink = new LavalinkManager({
181
+ // ... other options
182
+ queueOptions: {
183
+ queueChangesWatcher: new myCustomWatcher(client)
184
+ }
185
+ })
186
+ ```
187
+
188
+ ***
189
+
100
190
  # UpdateLog
101
191
 
102
192
  ## **Version 1.2.0**