Added docs

This commit is contained in:
Szymon Uglis 2019-07-14 16:16:38 +02:00
parent 7c0f6f1072
commit bab3624404
4 changed files with 11 additions and 4 deletions

View file

@ -30,8 +30,8 @@ This is fork of [Hackzzila's](https://github.com/Hackzzila) [nyx](https://github
Basic usage:
```dart
void main() {
var bot = Nyxx(Platform.environment['DISCORD_TOKEN']);
final bot = NyxxVm(Platform.environment['DISCORD_TOKEN']);
bot.onMessageReceived.listen((MessageEvent e) {
if (e.message.content == "!ping") {
e.message.channel.send(content: "Pong!");
@ -43,8 +43,9 @@ void main() {
Commands:
```dart
void main() {
nyxx.Nyxx bot = nyxx.Nyxx(Platform.environment['DISCORD_TOKEN']);
command.CommandsFramework('!', bot)
final bot = NyxxVm(Platform.environment['DISCORD_TOKEN']);
CommandsFramework('!', bot)
..admins = [nyxx.Snowflake("302359032612651009")]
..registerLibraryCommands();
}

View file

@ -8,9 +8,11 @@ import 'nyxx.dart';
export 'nyxx.dart';
/// Subclass of Nyxx class intended to be used in browser environment
class NyxxBrowser extends Nyxx {
NyxxBrowser._private(String token, {ClientOptions options, bool ignoreExceptions = true}) : super(token, options: options, ignoreExceptions: ignoreExceptions);
/// Sets up nyxx for browser usage and returns new Nyxx instance
factory NyxxBrowser(String token, {ClientOptions options, bool ignoreExceptions = true}) {
configureWTransportForBrowser();
setup = true;

View file

@ -8,9 +8,11 @@ import 'nyxx.dart';
export 'nyxx.dart';
/// Subclass of Nyxx class intended to be used in vm environment
class NyxxVm extends Nyxx {
NyxxVm._private(String token, {ClientOptions options, bool ignoreExceptions = true}) : super(token, options: options, ignoreExceptions: ignoreExceptions);
/// Sets up nyxx for vm usage and returns new Nyxx instance
factory NyxxVm(String token, {ClientOptions options, bool ignoreExceptions = true}) {
configureWTransportForVM();
setup = true;

View file

@ -127,6 +127,8 @@ class CommandContext {
else
m[r.emoji] = 1;
}
return m;
}).timeout(duration, onTimeout: () => m);
}