nyxx_lavalink 2.0.1 nyxx_lavalink: ^2.0.1 copied to clipboard
Nyxx Lavalink Module
nyxx_lavalink #
Simple, robust framework for creating discord bots for Dart language.
Features #
- Slash commands support
Supports and provides easy API for creating and handling slash commands - Commands framework included
A fast way to create a bot with command support. Implementing the framework is simple - and everything is done automatically. - Lavalink support
Nyxx allows you to create music bots by adding support to Lavalink API - Cross Platform
Nyxx works on the command line, in the browser, and on mobile devices. - Fine Control
Nyxx allows you to control every outgoing HTTP request or WebSocket message. - Complete
Nyxx supports nearly all Discord API endpoints.
Quick example #
Basic usage:
void main() {
final bot = Nyxx("TOKEN", GatewayIntents.allUnprivileged);
bot.onMessageReceived.listen((event) {
if (event.message.content == "!ping") {
event.message.channel.sendMessage(MessageBuilder.content("Pong!"));
}
});
}
Slash commands:
void main() {
final bot = Nyxx("<%TOKEN%>", GatewayIntents.allUnprivileged);
Interactions(bot)
..registerSlashCommand(
SlashCommandBuilder("hi", "This is example slash command", [])
..registerHandler((event) async {
await event.acknowledge();
await event.respond(MessageBuilder.content("Hello World!"));
})
);
}
Commands:
void main() {
final bot = Nyxx("TOKEN", GatewayIntents.allUnprivileged);
Commander(bot, prefix: "!!!")
..registerCommand("ping", (context, message) => context.reply(MessageBuilder.content("Pong!")));
}
Lavalink
void main() async {
final bot = Nyxx("TOKEN", GatewayIntents.allUnprivileged);
final guildId = Snowflake("GUILD_ID");
final channelId = Snowflake("CHANNEL_ID");
final cluster = Cluster(bot, Snowflake("BOT_ID"));
await cluster.addNode(NodeOptions());
bot.onMessageReceived.listen((event) async {
if (event.message.content == "!join") {
final channel = await bot.fetchChannel<VoiceGuildChannel>(channelId);
cluster.getOrCreatePlayerNode(guildId);
channel.connect();
} else {
final node = cluster.getOrCreatePlayerNode(guildId);
final searchResults = await node.searchTracks(event.message.content);
node.play(guildId, searchResults.tracks[0]).queue();
}
});
}
More examples #
Nyxx examples can be found here.
Commander examples can be found here
Slash commands (interactions) examples can be found here
Lavalink examples can be found here
Example bots #
Documentation, help and examples #
Dartdoc documentation is hosted on pub. This wiki just fills gap in docs with more descriptive guides and tutorials.
Discord API docs
Discord API documentation features rich descriptions about all topics that nyxx covers.
Discord API Guild
The unofficial guild for Discord Bot developers. To get help with nyxx check #dart_nyxx
channel.
Dartdocs
The dartdocs page will always have the documentation for the latest release.
Dev docs
You can read about upcoming changes in the library on my website.
Wiki
Wiki documentation are designed to match the latest Nyxx release.
Contributing to Nyxx #
Credits #
- Hackzzila's for nyx.