mercury 0.2.0

Mercury #

A Dart wrapper for the Discord API. Feel free to contribute!

Documentation is available here, and examples can be found in the example directory.

Features #

  • Speedy (built upon the latest versions of the Dart SDK and web APIs)
  • Small dependency tree (only one direct dependency - w_transport, for both WebSocket and REST // five development dependencies)
  • Predictable - robust and well-defined type checks included with all models
  • Multiplatform - runs anywhere Dart VM (Web support soon) does

Example #

A quick example of the client in action: (More examples available in the example folder)

import 'package:mercury/mercury.dart' as discord;

import 'package:w_transport/vm.dart' show vmTransportPlatform;
// Dart for Web: import 'package:w_transport/browser.dart' show browserTransportPlatform;

void main() {
  var client = new discord.Session(vmTransportPlatform /* dart for web: browserTransportPlatform */);
  client.setToken('MY TOKEN', discord.TokenType.Bot)
  client.dispatcher.messageCreate.listen((discord.Message msg) async {
    print('Received message with ID ${msg.id} (Channel ID ${msg.channel.id})');
    print('Content: ${msg.content}');
    if (msg.content == '!ping') {
      await msg.channel.createMessage('Pong!');
    }
  });
  client.dispatcher.ready.listen((empty) {
    print('Ready');
  });
  client.start();
}

Contributing #

Contributing guidelines:

  • Please use dartfmt and follow Dart's standard formatting rules for all your contributions
  • Please follow the naming conventions already laid out in the project
  • The tests haven't been fully written yet, so you can run pub run tool/dev_bot.dart (check file for the environment variables to set) to run a dev instance/test client of Mercury.

Features and bugs #

Please file feature requests and bugs at the issue tracker.

0.2 #

  • Revamp caching for all Discord models
  • Project renamed as Mercury
  • DiscordClient -> Session
  • WebSocketClient -> WebSocketSession
  • RestClient -> RestSession
  • Internal structure changed, now more flat
  • Added EmbedBuilder and EntityCollection
  • Added Messageable
  • Added GuildCategoryChannel
  • Revamped exception logic

0.1.20-dev #

  • Add logging system
  • Remove TObjectId type parameter from internal entities

0.1.12 #

  • Jump releases for Pub publishing

0.1.2 #

  • Added Guild object
    • Added guildUpdate and guildCreate events
  • Added caching system for most Discord objects
  • Added image CDN endpoints for User and Guild

0.1.11 #

  • Fixed docs

0.1.1 #

  • Added caching for channels
  • Added channelCreate and channelUpdate events
  • Refactor entity system
  • Fix REST requests

Use this package as a library

1. Depend on it

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


dependencies:
  mercury: ^0.2.0

2. Install it

You can install packages from the command line:

with pub:


$ pub get

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

3. Import it

Now in your Dart code, you can use:


import 'package:mercury/mercury.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
0
Health:
Code health derived from static analysis. [more]
--
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
--
Overall:
Weighted score of the above. [more]
0
Learn more about scoring.

The package version is not analyzed, because it does not support Dart 2. Until this is resolved, the package will receive a health and maintenance score of 0.

Analysis issues and suggestions

Support Dart 2 in pubspec.yaml.

The SDK constraint in pubspec.yaml doesn't allow the Dart 2.0.0 release. For information about upgrading it to be Dart 2 compatible, please see https://dart.dev/dart-2#migration.

Maintenance issues and suggestions

Make sure dartdoc successfully runs on your package's source files. (-10 points)

Dependencies were not resolved.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.0.0-dev.40.0 <=3.0.0