bdfd-lavalink-revamp
v1.0.1
Published
Play music in BDFD using lavalink.
Downloads
16
Readme
BDFD Lavalink
DISCLAIMER
We are no longer downloading files.
To connect to the lavalink server, put this code in a file on your host (f.e: index.js):
const { LavalinkServer } = require('bdfd-lavalink')
const server = new LavalinkServer({
apiPort: 3000,
url: "address_of_host",
lavalinkPort: "lavalink port"
})
<warn> MAKE SURE YOU ARE HOSTING A LAVALINK SERVER ON GIVEN HOST URL </warn>
server.init('bot token') // We instantiate a discord client to interact with voice channels.
Run the file and wait for the server and client to be connected.
Available Endpoints
Note that all examples are with BDFD.
POST /join_voice_channel
Causes the bot to join desired voice channel using its ID.
$httpPost[http://host_address:3000/join_voice_channel;{"id":"channel id"}]
GET /voice_channel_id/{guild_id}/{user_id}
Get the voice channel ID of a guild member, or empty if none.
$httpGet[http://host_address:3000/$guildID/$authorID]
$httpResult[voice_id]
GET /search
Performs a search on YouTube.
$httpGet[http://host_address:3000/search?q=never+gonna+give+you+up]
$httpResult[loadType]
$httpResult[tracksLength]
GET /track_info/{guild_id}
Gets current played track or a different track with given position.
$httpGet[http://host_address:3000/track_info/$guildID]
$httpResult[loadType]
$httpResult[title]
Next track:
$httpGet[http://host_address:3000/track_info/$guildID?offset=2]
$httpResult[loadType]
$httpResult[title]
POST /play/{guild_id}
Plays a song or adds it to the queue.
$httpGet[http://host_address:3000/search?q=never+gonna+give+you+up]
$var[track;$httpResult[tracks;0;track]]
$httpPost[http://host_address:3000/play/$guildID;{"track":"$var[track]"}]
$c[Anything that is not SUCCESS means an error.]
$httpResult[type]
$c[This will return true if it the provided track will be played now.]
$httpResult[playing_now]
POST /resume/{guild_id}
Resumes paused track in a guild.
$httpPost[http://host_address:3000/resume/$guildID]
$httpResult[type]
POST /pause/{guild_id}
Pauses current playing track in a guild.
$httpPost[http://host_address:3000/resume/$guildID]
$httpResult[type]
POST /volume/{guild_id}
Sets volume of tracks in a guild.
$httpPost[http://host_address:3000/volume/$guildID;{"volume":125}]
$httpResult[type]
POST /seek/{guild_id}
Seeks a playing track in a guild.
$c[Position is in milliseconds]
$httpPost[http://host_address:3000/seek/$guildID;{"seek":60000}]
$httpResult[type]
POST /search_and_play/{guild_id}
Searches and plays (or queues) a track in a guild.
$c[I am not sure if these requests require a body therefore im leaving it empty.]
$httpPost[http://host_address:3000/search_and_play/$guildID?q=my+cool+song;{}]
$httpResult[type]
POST /skip/{guild_id}
Skips current song.
$c[I am not sure if these requests require a body therefore im leaving it empty.]
$httpPost[http://host_address:3000/skip/$guildID;{}]
$httpResult[type]