Socket
Socket
Sign inDemoInstall

shoukaku

Package Overview
Dependencies
7
Maintainers
1
Versions
69
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 2.1.6 to 3.0.0

.eslintrc.json

25

package.json
{
"name": "shoukaku",
"version": "2.1.6",
"version": "3.0.0",
"description": "A lavalink wrapper that supports almost all libraries",
"main": "index.js",
"types": "types/index.d.ts",
"main": "dist/index.js",
"scripts": {
"docs:build": "docma build",
"docs:dev": "docma serve"
"compile": "tsc",
"build": "npm run compile && npm run build:docs",
"build:docs": "typedoc --theme default --readme README.md --out docs/ --entryPointStrategy expand src/.",
"prepare": "tsc --outDir ./dist"
},

@@ -35,7 +36,15 @@ "keywords": [

"petitio": "^1.4.0",
"ws": "^8.5.0"
"ws": "^8.6.0"
},
"devDependencies": {
"docma": "github:Deivu/docma#cd93f9c20453127e2eae928ddd7e30a1f927fad9"
"@augu/eslint-config": "^2.2.0",
"@types/node": "^17.0.35",
"@types/ws": "^8.5.3",
"@typescript-eslint/eslint-plugin": "^5.25.0",
"@typescript-eslint/parser": "^5.25.0",
"eslint": "^8.16.0",
"ts-node": "^10.8.0",
"typedoc": "^0.22.15",
"typescript": "^4.6.4"
}
}
}
## Shoukaku
> A featureful lavalink wrapper for Lavalink
> A stable and updated wrapper around Lavalink

@@ -13,41 +13,100 @@ [![Discord](https://img.shields.io/discord/423116740810244097?style=flat-square)](https://discordapp.com/invite/FVqbtGu)

<p align="center">
<img src="https://raw.githubusercontent.com/Deivu/Shoukaku/master/assets/cover.png">
<img src="https://cdn.donmai.us/original/0e/a4/0ea4a25416f850823d62d61ce51fc659.png" height="600">
</p>
> The ShipGirl Project, feat Shoukaku; ⓒ Kancolle
### Features
✅ Straightforward
✅ Stable
✅ Feature-rich
✅ Documented
✅ Very cute shipgirl ❤ (Very Important)
✅ Updated
✅ Extendable
✅ Very cute (Very Important)
### Supported Libraries
Refer to [/src/libraries](https://github.com/Deivu/Shoukaku/tree/master/src/libraries) for list of supported libraries + how to support other libraries
Refer to [/src/connectors](https://github.com/Deivu/Shoukaku/tree/master/src/connectors) for list of supported libraries + how to support other libraries
### Installation
> NPM (Stable) => npm install shoukaku --save
### Small code snippet examples
> Initializing the library (Using Connector Discord.JS)
```js
const { Client } = require('discord.js');
const { Shoukaku, Connectors } = require('shoukaku');
const Nodes = [{
name: 'Localhost',
url: 'localhost:6969',
auth: 'marin_kitagawa'
}];
const client = new Client();
const shoukaku = new Shoukaku(new Connectors.DiscordJS(client), Nodes);
// ALWAYS handle error
shoukaku.on('error', (_, error) => console.error(error));
client.login('token');
```
> Searching and joining a channel (Async Function Implementation)
```js
const node = shoukaku.getNode();
if (!node) return;
const result = await node.rest.resolve('scsearch:snowhalation');
if (!result?.tracks.length) return;
const metadata = result.tracks.shift();
const player = await node.joinVoiceChannel({
guildId: 'your_guild_id',
channelId: 'your_channel_id',
shardId: 0 // if unsharded it will always be zero (depending on your library implementation)
});
// player is created and ready, do your thing
```
> Playing a track and changing a playback option (in this example, volume)
```js
player
.playTrack(metadata.track)
.setVolume(0.5);
```
> Github (Dev) => npm install Deivu/Shoukaku#next
### Shoukaku's options
Option | Type | Description
--------|------|------------
resume | boolean | Whether to resume a connection on disconnect to Lavalink |
resumeKey | string | Resume key for Lavalink |
resumeTimeout | number | Timeout before resuming a connection **in seconds** |
reconnectTries | number | Number of times to try and reconnect to Lavalink before giving up |
reconnectInterval | number | Timeout before trying to reconnect **in milliseconds** |
restTimeout | number | Time to wait for a response from the Lavalink REST API before giving up **in milliseconds** |
moveOnDisconnect | boolean | Whether to move players to a different Lavalink node when a node disconnects |
userAgent | string | User Agent to use when making requests to Lavalink |
structures | Object{rest?, player?} | Custom structures for shoukaku to use |
### Documentation
### Plugins list
> https://deivu.github.io/Shoukaku/
> Open a pr to add your plugin here
### Getting Lavalink
Name | Link | Description
-------|----------|------------
..... | ........ | ..........
Download the latest binaries from the [Lavalink's README](https://github.com/freyacodes/Lavalink#server-configuration)
### Creating Plugins
> Shoukaku has now official supports for plugins. However, implementing this is up to the developers that is interested on doing it
Put an [application.yml](https://github.com/freyacodes/Lavalink/blob/master/LavalinkServer/application.yml.example) file in your working directory.
> Shoukaku support modification on Rest.ts and Player.ts
Run with `java -jar Lavalink.jar`
> To apply your plugin, put the extended classes on **ShoukakuOptions.structures**. Example below
Docker images are available on the [Docker](https://hub.docker.com/r/fredboat/lavalink/) hub.
```js
const { Client } = require('discord.js');
const { Shoukaku, Rest, Connectors } = require('shoukaku');
class CustomRest extends Rest { }; // extended structure of your choice
const Nodes = [{
name: 'Localhost',
url: 'localhost:6969',
auth: 'marin_kitagawa'
}];
const ShoukakuOptions = { structures: { rest: CustomRest } } // pass the custom structure to Shoukaku
const client = new Client();
const shoukaku = new Shoukaku(new Connectors.DiscordJS(client), Nodes, ShoukakuOptions);
```
### Other Links

@@ -57,6 +116,6 @@

### Example (Discord.JS)
### Implementation (Discord.JS)
> https://github.com/Deivu/Kongou
> Bot Implementation: https://github.com/Deivu/Kongou
> Made with ❤ by @Sāya#0113
### Made with ❤ by:
> @Sāya#0113
SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc