selene 0.3.2

  • Example
  • Installing
  • Versions
  • new50


Travis Pub

An unofficial Dart client for the Discord API.

  • Features:
    • REST and WebSocket APIs loosely coupled, so you can write your own implementation (or use the default)
    • Strongly-typed mapped entities with OOP navigational properties
  • Planned:
    • Sending and receiving voice
    • Automatic WebSocket connection recovering and restarting
    • Sharding support (and autosharding)


You can browse the example folder for some basic examples. The developer bot instance, test/selene_test.dart, is a comprehensive test of the latest functionality.


View the package listing for installation instructions.
You will need Dart SDK 2.0.0-dev.55.0 or above.


Documentation is generated with dartdoc, simply using the dartdoc command with no parameters.
Hosted documentation is available here.


Copyright (c) 2018 sarcasmloading under the MIT License. All rights reserved.



  • Minor cleanup


  • Documentation not appearing for several classes



  • Finally implemented EmbedBuilder class and appropriate parameters on TextChannel.sendMessage


  • Fixed breaking issue: NRE thrown on Message.member



  • Major: Overhauled how entities are initialised and cached
  • Cleaned up library as a whole, fixed a lot of issues
  • EntityCache has been renamed to ClientState

Breaking Changes

  • ClientState.self has been renamed to ClientState.currentUser


  • Documented User, PermissionOverwrite and GuildRole
  • Documented numerous minor methods and objects
  • Shortcuts on Client to numerous ClientState fields


  • Reaction support has been removed temporarily
    • Will likely return during release cycle 0.3.2 - 0.3.5



  • Converted _Dispatcher to public Dispatcher for documentation access



  • Fixed null fields on client
  • Fixed duplicate roles appearing after a guild update
  • Fixed random crashing when attempting to update a role


  • Added more events to the dispatcher type


  • Reconfigured how channels are stored


  • Removed VM/web options due to internal technical restraints
    • This support will return in a future update


import 'dart:async';

import 'package:logging/logging.dart';
import 'package:selene/selene.dart' as discord;

void main() {

Future runBot() async {
  // Create our client instance
  var client = new discord.Client();

  // Listen for log events
  Logger.root.onRecord.listen((LogRecord record) {
    print('[${record.loggerName}] ${}: ${record.time}: ${record

  // Event Guidelines
  // - You MUST catch exceptions thrown in your event handlers. Due to Dart limitations,
  // the library CANNOT catch exceptions thrown from stream subscriptions.
  // If you don't catch them, they will KILL the WebSocket connection and the bot
  // will go offline!

  // Listen to the message created event
  client.dispatcher.onMessageReceive.listen((discord.Message message) async {
    if (message.content == '!ping') {
      // Pong
              'Pong!'); // sendMessage takes either content, embed or both. At least one must be supplied.

    if (message.content == '!whoareyou' || message.content == '!bot') {
      var bot = client.state.currentUser; // Get the client's current user
      // Create an embed
      var embed = new discord.EmbedBuilder(); = new discord.EmbedAuthorBuilder.fromUser(
          bot); // Fill in properties from user
      embed.description =
          "Hello there! I am ${bot.username}#${bot.discriminator}!";
          .sendMessage(embed: embed); // Construct embed

  // Login and authorize
    'MyToken', /* type: 'Bot' -- This parameter is optional and defaults to Bot. */

  // Initiate WebSocket connection
  await client.start();

  // Client will automatically block the thread

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:

  selene: "^0.3.2"

2. Install it

You can install packages from the command line:

with pub:

$ pub get

with Flutter:

$ flutter packages get

Alternatively, your editor might support pub get or flutter packages get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:

      import 'package:selene/selene.dart';
Version Uploaded Documentation Archive
0.3.2 Jul 15, 2018 Go to the documentation of selene 0.3.2 Download selene 0.3.2 archive
0.3.1 Jul 15, 2018 Go to the documentation of selene 0.3.1 Download selene 0.3.1 archive
0.3.0 Jul 15, 2018 Go to the documentation of selene 0.3.0 Download selene 0.3.0 archive
0.2.1 Jul 10, 2018 Go to the documentation of selene 0.2.1 Download selene 0.2.1 archive
0.2.0 Jul 10, 2018 Go to the documentation of selene 0.2.0 Download selene 0.2.0 archive
0.1.0 Jul 10, 2018 Go to the documentation of selene 0.1.0 Download selene 0.1.0 archive


We analyzed this package on Jul 15, 2018, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.0.0-dev.63.0
  • pana: 0.11.3


Describes how popular the package is relative to other packages. [more]
0 / 100
Code health derived from static analysis. [more]
99 / 100
Reflects how tidy and up-to-date the package is. [more]
100 / 100
Overall score:
Weighted score of the above. [more]
Learn more about scoring.


Detected platforms: Flutter, other

Primary library: package:selene/selene.dart with components: io.


  • The description is too short.

    Add more detail about the package, what it does and what is its target use case. Try to write at least 60 characters.

  • Fix analysis and formatting issues.

    Analysis or formatting checks reported 19 hints.

    Run dartfmt to format lib/src/core/client.dart.

    Run dartfmt to format lib/src/core/dispatcher.dart.

    Similar analysis of the following files failed:

    • lib/src/models/channels/channel.dart (hint)
    • lib/src/models/channels/guild_category_channel.dart (hint)
    • lib/src/models/channels/guild_channel.dart (hint)
    • lib/src/models/channels/guild_text_channel.dart (hint)
    • lib/src/models/channels/guild_voice_channel.dart (hint)
    • lib/src/models/channels/text_channel.dart (hint)
    • lib/src/models/emote.dart (hint)
    • lib/src/models/entity.dart (hint)
    • lib/src/models/guilds/guild.dart (hint)
    • lib/src/models/member.dart (hint)
    • lib/src/models/message.dart (hint)
    • lib/src/models/user.dart (hint)
    • lib/src/rest/request_bucket.dart (hint)
    • lib/src/rest/rest_api.dart (hint)
    • lib/src/util/embed_builder.dart (hint)
    • lib/src/ws/websocket.dart (hint)
  • Package is pre-v1 release.

    While there is nothing inherently wrong with versions of 0.*.*, it usually means that the author is still experimenting with the general direction API.

  • Enable strong mode analysis.

    Strong mode helps you to detect bugs and potential issues earlier.Start your analysis_options.yaml file with the following:

      strong-mode: true


Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.0.0-dev.55.0 <2.0.0
logging ^0.11.3+1 0.11.3+1
w_transport ^3.0.0 3.2.5
Transitive dependencies
browser 0.10.0+3
charcode 1.1.2
collection 1.14.10
dart2_constant 1.0.1+dart2
fluri 1.2.4
http_parser 3.1.2
intl 0.15.6
js 0.6.1
mime 0.9.6+1
path 1.6.1
sockjs_client 0.3.3
sockjs_client_wrapper 1.0.4
source_span 1.4.0
string_scanner 1.0.2
typed_data 1.1.5
w_common 1.13.0
Dev dependencies
meta ^1.0.5 1.1.5
test ^0.12.30