lavalink_plugins 1.0.0 copy "lavalink_plugins: ^1.0.0" to clipboard
lavalink_plugins: ^1.0.0 copied to clipboard

A package for lavalink that distribute bindings for some lavalin plugins

example/example.dart

import 'package:lavalink/lavalink.dart';
import 'package:lavalink_plugins/lavalink_plugins.dart';

/// An example of using the Sponsorblock plugin with Lavalink.
/// This example connects to a Lavalink server, adds the Sponsorblock plugin,
/// and listens for segment skipped events.
///
/// We assume you have a running Lavalink server with the Sponsorblock plugin installed and the youtube plugin enabled.

void main(List<String> args) async {
  final client = await LavalinkClient.connect(
    Uri.http('localhost:2333'),
    password: 'youshallnotpass',
    userId: '1',
    plugins: (client) => [SponsorblockPlugin(client)],
  );

  final sponsorblock = client.plugins.whereType<SponsorblockPlugin>().first;

  print('Connected to Lavalink v${await client.getVersion()}');

  // Assume a voice server/state update has happened and we have a player ready

  await sponsorblock.putCategories('123456789123456789', [SegmentCategory.outro]);

  await client.updatePlayer('123456789123456789', identifier: 'https://www.youtube.com/watch?v=aqz-KE-bpKQ');

  client.connection.listen((message) {
    if (message is! LavalinkEvent) {
      return;
    }
    if (message is SegmentSkipped) {
      print('Segment has been skipped: from ${message.segment.start} to ${message.segment.end} (${message.segment.category.category})');
    }
  });
}
0
likes
160
points
84
downloads

Documentation

API reference

Publisher

unverified uploader

Weekly Downloads

A package for lavalink that distribute bindings for some lavalin plugins

Repository (GitHub)
View/report issues
Contributing

License

Apache-2.0 (license)

Dependencies

json_annotation, lavalink

More

Packages that depend on lavalink_plugins