From 75f2d0bf634a113231dcb8c88bd405a3c3dd637e Mon Sep 17 00:00:00 2001 From: Zachary Vacura Date: Tue, 20 Sep 2016 19:49:41 -0500 Subject: [PATCH] Fixed a few things --- example/ping-pong.dart | 6 ++++-- lib/src/client.dart | 26 -------------------------- pubspec.yaml | 2 +- 3 files changed, 5 insertions(+), 29 deletions(-) diff --git a/example/ping-pong.dart b/example/ping-pong.dart index 82d9217..746cc99 100644 --- a/example/ping-pong.dart +++ b/example/ping-pong.dart @@ -3,11 +3,13 @@ import 'package:discord_dart/discord.dart' as discord; main() { var bot = new discord.Client("your token"); - bot.onEvent('ready', () { + bot.on('ready', (e) { print("Ready!"); }); - bot.onEvent('message', (m) async { + bot.onEvent('message', (e) { + var m = e.message; + if (m.content == "!ping") { bot.sendMessage(m.channel, "Pong!"); } diff --git a/lib/src/client.dart b/lib/src/client.dart index c3eb9a2..65dfc16 100644 --- a/lib/src/client.dart +++ b/lib/src/client.dart @@ -14,26 +14,6 @@ class Client extends Events { int _lastS = null; String _sessionID; API _api = new API(); - Map _handlers = { - "ready": [], - "message": [], - "messageDelete": [], - "messageEdit": [], - "debug": [], - "loginError": [], - "guildCreate": [], - "guildUpdate": [], - "guildDelete": [], - "guildBanAdd": [], - "guildBanRemove": [], - "guildMemberAdd": [], - "guildMemberRemove": [], - "guildMemberUpdate": [], - "channelCreate": [], - "channelUpdate": [], - "channelDelete": [], - "typing": [] - }; /// The token passed into the constructor. String token; @@ -68,8 +48,6 @@ class Client extends Events { Future _handleMsg(msg) async { var json = JSON.decode(msg); - this._handlers['debug'].forEach((function) => function(json)); - if (json['s'] != null) { this._lastS = json['s']; } @@ -93,10 +71,6 @@ class Client extends Events { })); } - else if (json['op'] == 9) { - this._handlers['loginError'].forEach((function) => function()); - } - /*else if (json['op'] == 7) { this._socket.add(JSON.encode({ "token": this.token, diff --git a/pubspec.yaml b/pubspec.yaml index bdaa343..547880b 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,5 +1,5 @@ name: discord_dart -version: 0.7.2 +version: 0.7.3 description: A Discord library for Dart author: Hackzzila homepage: https://github.com/Hackzzila/Discord-Dart