nyxx 3.2.3 copy "nyxx: ^3.2.3" to clipboard
nyxx: ^3.2.3 copied to clipboard

outdated

A Discord library for Dart. Simple, robust framework for creating discord bots for Dart language.

example/example.dart

import "package:nyxx/nyxx.dart";

// Main function
void main() {
  // Create new bot instance
  final bot = NyxxFactory.createNyxxWebsocket("<TOKEN>", GatewayIntents.allUnprivileged)
    ..registerPlugin(Logging()) // Default logging plugin
    ..registerPlugin(CliIntegration()) // Cli integration for nyxx allows stopping application via SIGTERM and SIGKILl
    ..registerPlugin(IgnoreExceptions()) // Plugin that handles uncaught exceptions that may occur
    ..connect();

  // Listen to ready event. Invoked when bot is connected to all shards. Note that cache can be empty or not incomplete.
  bot.eventsWs.onReady.listen((e) {
    print("Ready!");
  });

  // Listen to all incoming messages
  bot.eventsWs.onMessageReceived.listen((e) {
    // Check if message content equals "!ping"
    if (e.message.content == "!ping") {
      // Send "Pong!" to channel where message was received
      e.message.channel.sendMessage(MessageBuilder.content("Pong!"));
    }
  });
}
101
likes
0
pub points
79%
popularity

Publisher

verified publisherl7ssha.xyz

A Discord library for Dart. Simple, robust framework for creating discord bots for Dart language.

Repository (GitHub)
View/report issues

Documentation

Documentation

License

unknown (license)

Dependencies

http, logging, path

More

Packages that depend on nyxx