circumstellar 0.1.51 circumstellar: ^0.1.51 copied to clipboard
A Dart wrapper for the Discord API. The project is currently in an early development stage. Feel free to contribute!
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:
import 'package:circumstellar/circumstellar.dart';
import 'package:w_transport/vm.dart' show vmTransportPlatform;
// Dart for Web: import 'package:w_transport/browser.dart' show browserTransportPlatform;
void main() {
var client = new DiscordClient(new AuthSet('MY_TOKEN', TokenType.Bot), vmTransportPlatform /* dart for web: browserTransportPlatform */);
client.dispatcher.messageCreate.listen((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
bin/dev.dart
(check file for the environment variables to set) to run a dev instance/test client of Circumstellar. You can also use the Shell scriptrun_bot.sh
.
Features and bugs #
Please file feature requests and bugs at the issue tracker.