Skip to content

JohnnyMorganz/discordia-lavalink

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Lavalink for Discordia [0.0.1]

This library is a Lavalink Client for Discordia

What is Lavalink?

Lavalink is an alternative method for playing audio in Discord Voice Channels. You can read more about it here To setup Lavalink, follow these instructions

Installing discordia-lavalink

This library is currently in development, however it is usable to an extent. Currently, to install, download the library and place it in your 'deps' folder I cannot guarantee that it is stable; if you find any issues, please report them.

Documentation

View the wiki to view the Documentation

Example Implementation

local discordia = require('discordia')
local Lavalink = require('discordia-lavalink')
local VoiceManager = Lavalink.VoiceManager

local client = discordia.Client()
local manager
local nodes = {
	{host = '127.0.0.1', port = 2333, password = 'youshallnotpass'}
}

client:on('ready', function()
	manager = VoiceManager(client, nodes)
end)

client:on('messageCreate', function(message)
	-- Handle Commands
	if command == 'joinvc' then
		manager:join(voiceChannel)
	elseif command == 'play' then
		local player = manager:getPlayer(voiceChannel)
		local info = manager.api:get(trackId)
		if info and info.tracks and #info.tracks > 0then
			player:play(info.tracks[1].track)
		end
	elseif command == 'leavevc' then
		manager:leave(voiceChannel)
	end
end)

TODO:

  • Add automatic load balancing for selecting a node for Player to join
  • Handle caching in the API

About

Lavalink Client for Discordia

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages