New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

harmonylink

Package Overview
Dependencies
Maintainers
0
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

harmonylink - npm Package Compare versions

Comparing version 1.0.0 to 1.1.0

4

package.json
{
"name": "harmonylink",
"version": "1.0.0",
"version": "1.1.0",
"description": "HarmonyLink: Seamlessly connect to LavaLink nodes for high-quality audio streaming in your applications. HarmonyLink offers a reliable and easy-to-use interface, perfect for building music bots and audio applications with superior performance.",

@@ -79,2 +79,4 @@ "main": "./dist/index.js",

"ts-patch": "^3.2.1",
"typedoc": "^0.26.4",
"typedoc-plugin-markdown": "^4.2.1",
"typescript-transform-paths": "^3.4.7"

@@ -81,0 +83,0 @@ },

@@ -37,5 +37,5 @@

<br>
<!-- <a href="https://nodei.co/npm/poru/">
<img src="https://nodei.co/npm/poru.png?downloads=true&downloadRank=true&stars=true" alt="Poru NPM Package"/>
</a> -->
<a href="https://nodei.co/npm/harmonylink/">
<img src="https://nodei.co/npm/harmonylink.png?downloads=true&downloadRank=true&stars=true" alt="Poru NPM Package"/>
</a>
</div>

@@ -70,4 +70,2 @@

[![Product Name Screen Shot][product-screenshot]](https://github.com/Joniii11/HarmonyLink)
Seamlessly connect to LavaLink nodes for high-quality audio streaming in your applications. HarmonyLink offers a reliable and easy-to-use interface, perfect for building music bots and audio applications with superior performance.

@@ -93,6 +91,6 @@

# Using npm
npm install poru
npm install harmonylink
# Using yarn
yarn add poru
yarn add harmonylink
```

@@ -104,4 +102,29 @@

Coming soon
```ts
// With Discord.js Version 14
import { DJSLibrary } from "HarmonyLink";
import { Client } from "discord.js"
// Initialize your client
const client = new Client();
const config: HarmonyLinkConfiguration = {
nodes: [
{
name: "Example Node",
host: "example.com",
port: 2333,
password: "youshallnotpass",
secure: false
}
] // Your nodes.
library: new DJSLibrary(client),
};
const HarmonyLink = new HarmonyLink(config)
// Creating a player
await HarmonyLink.createPlayer()
```
_For more examples, please refer to the [Documentation](https://github.com/Joniii11/HarmonyLink)_

@@ -108,0 +131,0 @@

import { ConnectionOptions } from "@t/player/connection";
import { PlayerOptions } from "@/typings/player";
export function getDefaultConnectionOptions(): ConnectionOptions {
export function getDefaultConnectionOptions(options: PlayerOptions): ConnectionOptions {
return {

@@ -11,5 +12,5 @@ voiceRegion: null,

},
selfDeaf: false,
selfMute: false,
selfDeaf: options.deaf ?? false,
selfMute: options.mute ?? false,
} satisfies ConnectionOptions;
};

@@ -101,3 +101,3 @@ /* eslint-disable @typescript-eslint/no-unsafe-declaration-merging */

*/
public async createPlayer(playerOptions: Omit<PlayerOptions, "shardId"> & { shardId?: string }, node?: Node): Promise<Player> {
public async createPlayer(playerOptions: Omit<PlayerOptions, "node">, node?: Node): Promise<Player> {
return this.playerManager.createPlayer({ ...playerOptions, node })

@@ -104,0 +104,0 @@ };

@@ -17,3 +17,3 @@ import { Player } from "@/player/Player";

public async createPlayer(options: Omit<PlayerOptions, "shardId"> & { shardId?: string }): Promise<Player> {
public async createPlayer(options: PlayerOptions): Promise<Player> {
if (this.has(options.guildId)) return this.get(options.guildId)!;

@@ -20,0 +20,0 @@

@@ -145,3 +145,3 @@ /* eslint-disable @typescript-eslint/no-invalid-void-type, @typescript-eslint/no-unsafe-declaration-merging */

*
* @docs https://lavalink.dev/api/rest.html#get-routeplanner-status
* @see https://lavalink.dev/api/rest.html#get-routeplanner-status
*/

@@ -156,3 +156,3 @@ public async getRoutePlannerStatus(): Promise<RoutePlannerStatus> {

*
* @docs https://lavalink.dev/api/rest.html#unmark-all-failed-address
* @see https://lavalink.dev/api/rest.html#unmark-all-failed-address
*/

@@ -168,3 +168,3 @@ public async unmarkAllFailingAddresses(): Promise<ErrorResponses | void> {

*
* @docs https://lavalink.dev/api/rest.html#unmark-a-failed-address
* @see https://lavalink.dev/api/rest.html#unmark-a-failed-address
*/

@@ -171,0 +171,0 @@ public async unmarkFailingAddress(address: string): Promise<ErrorResponses | void> {

import { DiscordVoiceStates, ConnectionOptions, SetStateUpdate, VoiceServer } from "@t/player/connection";
import { Player } from "./Player";
import { getDefaultConnectionOptions } from "@/constants/player";
import { VoiceConnectionState } from "@/typings/player";
import { PlayerOptions, VoiceConnectionState } from "@/typings/player";

@@ -10,5 +10,5 @@ export class ConnectionHandler {

public constructor(player: Player) {
public constructor(player: Player, options: PlayerOptions) {
this.player = player;
this.options = getDefaultConnectionOptions();
this.options = getDefaultConnectionOptions(options);
};

@@ -21,4 +21,2 @@

public async setServersUpdate(data: VoiceServer): Promise<void> {
console.log(data)
if (!data.endpoint) {

@@ -25,0 +23,0 @@ this.player.emit('connectionUpdate', DiscordVoiceStates.SESSION_ENDPOINT_MISSING);

@@ -57,3 +57,3 @@ /* eslint-disable max-lines, @typescript-eslint/no-unused-expressions, @typescript-eslint/no-unsafe-declaration-merging, no-sequences, @typescript-eslint/naming-convention */

public constructor(manager: HarmonyLink, node: Node, options: Omit<PlayerOptions, "shardId"> & { shardId?: string }) {
public constructor(manager: HarmonyLink, node: Node, options: PlayerOptions) {
super();

@@ -82,3 +82,3 @@

// Handlers
this.ConnectionHandler = new ConnectionHandler(this)
this.ConnectionHandler = new ConnectionHandler(this, options)
this.queue = new Queue();

@@ -105,2 +105,3 @@ this.filters = new Filters(this)

* Connects the player to the voice channel.
*
* @returns {Promise<Player>} - A Promise that resolves to the Player instance.

@@ -456,4 +457,32 @@ */

}
}
};
/**
* Sets the mute state for the player.
* @param {boolean} mute - Whether to mute or unmute the player in the voice channel.
* @returns {Promise<Player>} - A Promise that resolves to the Player instance.
*/
public async setMute(mute: boolean): Promise<Player> {
return new Promise<Player>((resolve) => {
this.ConnectionHandler.options.selfMute = mute;
this.sendVoiceUpdate();
return resolve(this);
});
};
/**
* Sets the deaf state for the player.
* @param {boolean} deaf - Whether to deafen or undeafen the player in the voice channel.
* @returns {Promise<Player>} - A Promise that resolves to the Player instance.
*/
public async setDeaf(deaf: boolean): Promise<Player> {
return new Promise<Player>((resolve) => {
this.ConnectionHandler.options.selfDeaf = deaf;
this.sendVoiceUpdate();
return resolve(this);
});
};
protected async disconnect(cleanQueue: boolean = false): Promise<Player> {

@@ -460,0 +489,0 @@ if (!this.voiceChannelId || this.voiceState === VoiceConnectionState.DISCONNECTED) return this;

@@ -117,3 +117,3 @@ import { PlayerState } from "@t/player";

* This interface represents the LavaLink V4 Error Responses
* @reference https://lavalink.dev/api/rest.html#error-responses
* @see https://lavalink.dev/api/rest.html#error-responses
*/

@@ -120,0 +120,0 @@ export interface ErrorResponses {

@@ -49,13 +49,38 @@ import { Node } from "@/node/Node";

export interface PlayerOptions {
/**
* The guild id to create the player for
*/
guildId: string;
/**
* The voice channel id to connect to
*/
voiceId: string;
/**
* The text channel id to send messages to
*/
textId: string;
shardId: string;
mute: boolean;
deaf: boolean;
/**
* The shard id this player's guild is on
* @optional
*/
shardId?: string;
/**
* If the player should be muted
* @optional
*/
mute?: boolean;
/**
* If the player should be deafened
* @optional
*/
deaf?: boolean;
/**
* The node to connect to
* @optional
*
*/

@@ -62,0 +87,0 @@ node?: Node;

/**
* The response of the player API
*
* @docs https://lavalink.dev/api/rest#playlist-info
* @see https://lavalink.dev/api/rest#playlist-info
*/

@@ -6,0 +6,0 @@ export interface PlaylistInfoFound {

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc