Comparing version 1.0.2 to 1.1.2
{ | ||
"name": "divish", | ||
"version": "1.0.2", | ||
"description": "An easy way to use...", | ||
"version": "1.1.2", | ||
"description": "An easy lavalink client base on erelajs.", | ||
"main": "dist/index.js", | ||
"types": "main/index.d.ts", | ||
"files": [ | ||
"dist", | ||
"main" | ||
], | ||
"types": "dist/index.d.ts", | ||
"files": [ "dist" ], | ||
"scripts": { | ||
"build": "tsc", | ||
"lint": "eslint --ext .ts ./src", | ||
"types": "dts-bundle --removeSource --name divish --main ./dist --out ../typings/index.d.ts --baseDir ./dist", | ||
"types": "dts-bundle --removeSource --name erela.js --main ./dist --out ../typings/index.d.ts --baseDir ./dist", | ||
"docs": "typedoc --json ./docs.json --mode file --excludeProtected --excludePrivate --excludeExternals src/structures", | ||
@@ -16,0 +13,0 @@ "publish:stable": "yarn build && yarn types && yarn publish --access=public", |
@@ -1,48 +0,44 @@ | ||
**Example | ||
# 📦 Divish | ||
# example for discord.js | ||
```js | ||
const { Manager } = require("divish"); | ||
// Initiate the Manager with some options and listen to some events. | ||
client.manager = new Manager({ | ||
// Pass an array of node. Note: You do not need to pass any if you are using the default values (ones shown below). | ||
nodes: [ | ||
// If you pass a object like so the "host" property is required | ||
{ | ||
host: "localhost", // Optional if Lavalink is local | ||
port: 2333, // Optional if Lavalink is set to default | ||
password: "youshallnotpass", // Optional if Lavalink is set to default | ||
}, | ||
], | ||
// A send method to send data to the Discord WebSocket using your library. | ||
// Getting the shard for the guild and sending the data to the WebSocket. | ||
send(id, payload) { | ||
const guild = client.guilds.cache.get(id); | ||
client.music = new Manager({ | ||
nodes: [{ | ||
host: "localhost", | ||
port: 2333, | ||
password: "youshallnotpass", | ||
secure: false | ||
}], | ||
send(id, payload) { | ||
let guild = client.guilds.cache.get(id); | ||
if (guild) guild.shard.send(payload); | ||
}, | ||
}); | ||
const music = client.music; | ||
music.on("nodeConnect", node => console.log(`Node ${node.options.identifier} connected`)) | ||
music.on("nodeError", (node, error) => console.log(`Node ${node.options.identifier} had an error: ${error.message}`)) | ||
music.on("trackStart", (player, track) => { | ||
client.channels.cache.get(player.textChannel)?.send(`NowPlaying ${track.title}`); | ||
}) | ||
.on("nodeConnect", node => console.log(`Node ${node.options.identifier} connected`)) | ||
.on("nodeError", (node, error) => console.log(`Node ${node.options.identifier} had an error: ${error.message}`)) | ||
.on("trackStart", (player, track) => { | ||
client.channels.cache | ||
.get(player.textChannel) | ||
.send(`Now playing: ${track.title}`); | ||
}) | ||
.on("queueEnd", (player) => { | ||
client.channels.cache | ||
.get(player.textChannel) | ||
.send("Queue has ended."); | ||
music.on("queueEnd", (player) => { | ||
client.channels.cache.get(player.textChannel)?.send("Queue has ended."); | ||
}); | ||
``` | ||
player.destroy(); | ||
}); | ||
# Spotify plugin | ||
[plugin](https://www.npmjs.com/package/divish-avance) | ||
// Ready event fires when the Discord.JS client is ready. | ||
// Use EventEmitter#once() so it only fires once. | ||
client.once("ready", () => { | ||
console.log("I am ready!"); | ||
// Initiate the manager. | ||
client.manager.init(client.user.id); | ||
}); | ||
# notice | ||
This package is base on erelajs but provide more features. so you can use it as advance version of erelajs | ||
// Here we send voice data to lavalink whenever the bot joins a voice channel to play audio in the channel. | ||
client.on("raw", (d) => client.manager.updateVoiceState(d)); | ||
``` | ||
# update | ||
[+] Fix voice lag. | ||
[+] Add typescript options. | ||
[+] YouTube music search is available. | ||
made by ronstufer with 💖 and dedication. | ||
Sorry, the diff of this file is not supported yet
110165
15
3107
45