@misudev/dconnect 1.6.2 → 1.6.3

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@misudev/dconnect",
3
- "version": "1.6.2",
3
+ "version": "1.6.3",
4
4
  "description": "Connect to Discord voice channel",
5
5
  "main": "index.mjs",
6
6
  "scripts": {
package/src/index.mjs CHANGED
@@ -125,7 +125,12 @@ class VoiceConnection extends EventEmitter {
125
125
  break;
126
126
 
127
127
  case VOICE_OP_CODES.HELLO:
128
- this.setupHeartbeat();
128
+ if (this.heartbeatInterval) clearInterval(this.heartbeatInterval);
129
+ this.heartbeatInterval = setInterval(() => {
130
+ this.ws.send(
131
+ JSON.stringify({ op: VOICE_OP_CODES.HEARTBEAT, d: Date.now() }),
132
+ );
133
+ }, d.heartbeat_interval);
129
134
  break;
130
135
  }
131
136
  }
package/src/utils.mjs DELETED
@@ -1,31 +0,0 @@
1
- import axios from 'axios';
2
- import chalk from 'chalk';
3
- import consola from 'consola';
4
-
5
- export async function getUserPresence(userID) {
6
- try {
7
- const response = await axios.get(`https://api.lanyard.rest/v1/users/${userID}`);
8
- return response.data;
9
- } catch (error) {
10
- consola.error(new Error(chalk.red(`An error occurred fetching data from the Lanyard API: ${error.message}`)));
11
- process.exit(1);
12
- }
13
- }
14
-
15
- export function isCustomEmoji(emoji) {
16
- if (!emoji || typeof emoji !== 'object') return false;
17
- return emoji.id && typeof emoji.id === 'string' && !emoji.id.startsWith('<a:');
18
- }
19
-
20
- export function formatDuration(duration) {
21
- const hours = Math.floor(duration / 3600);
22
- const minutes = Math.floor((duration % 3600) / 60);
23
- const seconds = Math.floor(duration % 60);
24
- if (hours > 0) {
25
- return `${hours}hr ${minutes}min ${seconds}sec`;
26
- } else if (minutes > 0) {
27
- return `${minutes}min ${seconds}sec`;
28
- } else {
29
- return `${seconds} seconds`;
30
- }
31
- }