GithubHelp home page GithubHelp logo

svr333 / victoria Goto Github PK

View Code? Open in Web Editor NEW

This project forked from yucked/victoria

0.0 0.0 0.0 1.8 MB

๐ŸŒ‹ - Lavalink wrapper for Discord.NET. Provides more options and performs better than all .NET Lavalink libraries combined.

Home Page: https://yucked.github.io/Victoria/

C# 100.00%

victoria's Introduction


๐ŸŒ‹ - Lavalink wrapper for Discord.NET which provides more options and performs better than all .NET Lavalink libraries combined.


โš”๏ธ Features:

With the release of Version 5, Victoria has now features from all previous versions. Some of these features are:

  • Keeping up to date with Lavalink features
  • Ability to extend Victoria for your needs
  • Lyrics support from OVH and Genius
  • Artwork support for YouTube, Vimeo, SoundCloud, Twitch
  • Built-in Queue support, built on top of LinkedList
  • Completely asynchronous
  • Fast deserialization and serialization with STJ and custom converters
  • Decoding track string with supernova speed (Thanks to Pluspy!)
  • Easy to understand API with complete documentation
  • AND a loving community without whom this project wouldn't be possible!

๐Ÿ‘‰ Please read the release notes to see what got changed, removed and, modified!

โš—๏ธ Quick Start:

Getting started with Victoria is fairly simple and quick:

  • Add Victoria package from Nuget.
  • Add LavaNode and LavaConfig to ServiceCollection.
// Make sure there is ONLY ONE instance of LavaNode and LavaConfig in your program unless you have several
// Lavalink instances running and would like to create node pool (which majority of the users don't).
// For version 5.1.2 and before.

	var services = new ServiceCollection()
		// Other services DiscordSocketClient, CommandService, etc
		.AddSingleton<LavaNode>()
		.AddSingleton<LavaConfig>();
		
	var provider = services.BuildServiceProvider();
// Make sure there is ONLY ONE instance of LavaNode and LavaConfig in your program unless you have several
// Lavalink instances running and would like to create node pool (which majority of the users don't).
// For versions 5.1.3 and above.

	var services = new ServiceCollection()
		// Other services DiscordSocketClient, CommandService, etc
		.AddLavaNode(x => {
            x.SelfDeaf = false;
        });
		
	var provider = services.BuildServiceProvider();
  • In your DiscordSocketClient or DiscordShardedClient Ready event call _instanceOfLavaNode.ConnectAsync();
	discordSocketClient.Ready += OnReadyAsync;
	....
	
	private async Task OnReadyAsync() {
	// Avoid calling ConnectAsync again if it's already connected 
	// (It throws InvalidOperationException if it's already connected).
		if (!_instanceOfLavaNode.IsConnected) {
			_instanceOfLavaNode.ConnectAsync();
		}
		
		// Other ready related stuff
	}
  • Create a Music/Audio command module and start writing Victoria related commands!
public sealed class MusicModule : SocketCommandContext {
	private readonly LavaNode _lavaNode;
	
	public MusicModule(LavaNode lavaNode)
		=> _lavaNode = lavaNode;
		
	[Command("Join")]
	public async Task JoinAsync() {	
            if (_lavaNode.HasPlayer(Context.Guild)) {
                await ReplyAsync("I'm already connected to a voice channel!");
                return;
            }

            var voiceState = Context.User as IVoiceState;
            if (voiceState?.VoiceChannel == null) {
                await ReplyAsync("You must be connected to a voice channel!");
                return;
            }

            try {
                await _lavaNode.JoinAsync(voiceState.VoiceChannel, Context.Channel as ITextChannel);
                await ReplyAsync($"Joined {voiceState.VoiceChannel.Name}!");
            }
            catch (Exception exception) {
                await ReplyAsync(exception.Message);
            }
	}
}

๐Ÿ‘‰ If you'd like a complete example, head over to https://yucked.github.io/Victoria/

victoria's People

Contributors

draxcodes avatar eloncase avatar fenikkusukoneko avatar flipch avatar huebyte avatar mitchell-t avatar yucked avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.