Added docs
This commit is contained in:
parent
7c0f6f1072
commit
bab3624404
|
@ -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();
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -127,6 +127,8 @@ class CommandContext {
|
|||
else
|
||||
m[r.emoji] = 1;
|
||||
}
|
||||
|
||||
return m;
|
||||
}).timeout(duration, onTimeout: () => m);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue