mercury 0.2.0

  • README.md
  • CHANGELOG.md
  • Installing
  • Versions
  • new55

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

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:mercury/mercury.dart';
  
Version Uploaded Documentation Archive
0.2.0 Jun 24, 2018 Go to the documentation of mercury 0.2.0 Download mercury 0.2.0 archive
0.1.6 Jun 24, 2018 Go to the documentation of mercury 0.1.6 Download mercury 0.1.6 archive
Popularity:
Describes how popular the package is relative to other packages. [more]
14
Health:
Code health derived from static analysis. [more]
99
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
90
Overall:
Weighted score of the above. [more]
55
Learn more about scoring.

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

  • Dart: 2.0.0-dev.69.0
  • pana: 0.11.7

Platforms

Detected platforms: Flutter, other

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

Issues and suggestions

Homepage does not exists.

We were unable to access https://github.com/jacksonrakena/mercury/ at the time of the analysis.

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 of the API.

Fix lib/src/event_dispatcher.dart.

Analysis of lib/src/event_dispatcher.dart reported 1 hint:

line 12 col 16: The value of the local variable 'aval' isn't used.

Fix lib/src/models/message.dart.

Analysis of lib/src/models/message.dart reported 1 hint:

line 73 col 9: The value of the local variable 'resp' isn't used.

Maintain an example.

None of the files in your example/ directory matches a known example patterns. Common file name patterns include: main.dart, example.dart or you could also use mercury.dart.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.0.0-dev.40.0 <=3.0.0
w_transport ^3.2.5 3.2.6
Transitive dependencies
browser 0.10.0+3
charcode 1.1.2
collection 1.14.11
dart2_constant 1.0.1+dart2
fluri 1.2.4
http_parser 3.1.3
intl 0.15.7
js 0.6.1+1
meta 1.1.6
mime 0.9.6+1
path 1.6.2
sockjs_client 0.3.3
sockjs_client_wrapper 1.0.4
source_span 1.4.1
string_scanner 1.0.3
typed_data 1.1.6
w_common 1.13.0
Dev dependencies
coverage ^0.8.0
dart_dev 2.0.0-alpha
dart_style ^0.2.0
dartdoc ^0.9.0
logging ^0.11.3+1 0.11.3+2
test ^0.12.0