-
-
Notifications
You must be signed in to change notification settings - Fork 29
Lavalink Plugins
Lavalink4NET supports multiple Lavalink plugins, including:
- SponsorBlock - A Lavalink plugin to skip SponsorBlock segments in YouTube videos.
- Google Cloud TTS - A Lavalink plugin to add support for Google TTS capabilities.
- Topis Source Manager - A Lavalink plugin to add some custom sources including Spotify & apple Music.
- Lavalink Filter Plugin - A Lavalink plugin to add additional filters like Echo. (Previously named Extra Filter Plugin)
- DuncteBot - A Lavalink plugin to add a ton of custom sources including MixCloud, Cyp.it, Reddit, Tiktok and many more.
To install plugins either download the latest release file from their respective respository and place it in your plugins
folder. You can also simply list them in your application.yml
. However, the application.yml
method will vary depending on the plugin you are adding. Refer to their specific repositories if you go this route.
To initialize the integration, call the UseSponsorBlock method on the audio service:
var audioService = serviceProvider.GetRequiredService<IAudioService>();
audioService.UseSponsorBlock();
You can configure the default categories to skip by:
var sponsorBlock = audioService.Integrations.Get<ISponsorBlockIntegration>();
sponsorBlock.DefaultSkipCategories = ImmutableArray.Create(
SegmentCategory.SelfPromotion,
SegmentCategory.Sponsor,
SegmentCategory.Intro,
SegmentCategory.Outro,
SegmentCategory.Filler,
SegmentCategory.Interaction,
SegmentCategory.Preview,
SegmentCategory.OfftopicMusic
);
Note: The above code snippit lists all current categories, you should only define/include the ones you would like to skip. By default, no categories are selected.
You can also configure sponsorblock on a per-guild basis, like:
var player = await GetPlayerAsync();
if(player == null)
{
return;
}
player.GetCategories().Add(SegmentCategory.Intro);
player.GetCategories().Remove(SegmentCategory.OfftopicMusic);
player.GetCategories().AddAll();
You can implement a basic version of the Google TTS system with the following code:
var track = await _audioService.GetTextToSpeechTrackAsync("Hello!").ConfigureAwait(false);
await player.PushTrackAsync(track).ConfigureAwait(false);
or you can configure more advanced settings using the following code:
var input = new SynthesisInput { Text = text, };
var options = new VoiceSelectionParameters
{
Gender = SsmlVoiceGender.Male,
LanguageCode = "de-DE",
};
var config = new AudioConfiguration
{
Pitch = 2F,
};
var track = await _audioService.GetTextToSpeechTrackAsync(input, options, config).ConfigureAwait(false);
await player.PushTrackAsync(track).ConfigureAwait(false);
The Topis Source Manager plugin does not require any configuration in Lavalink4Net. All you have to do is install it in Lavalink as a plugin and enqueue tracks like you would normally.
The lavalink filter plugin does not require any configuration in Lavalink4Net. All you have to do is install it in Lavalink as a plugin and use the following code to apply it:
var options = new EchoFilterOptions
{
Delay = 1,
Decay = 0
};
player.Filters.Echo(options);
await player.Filters.CommitAsync();
Due to these being external filters, the process to get the current values of them are also differnet. For example, you can get the current values of the echo filter with this:
var echoDelay = (player.Filters?[EchoFilterOptions.Name] as EchoFilterOptions)?.Delay ?? 1;
var echoDecay = (player.Filters?[EchoFilterOptions.Name] as EchoFilterOptions)?.Decay ?? 0;
The DuncteBot plugin does not require any configuration in Lavalink4Net. All you have to do is install it in Lavalink as a plugin and enqueue tracks like you would normally.
Lavalink4NET Wiki - Licensed under MIT