Skip to content

Commit

Permalink
Fixed a few things
Browse files Browse the repository at this point in the history
  • Loading branch information
Hackzzila committed Sep 21, 2016
1 parent 6e87959 commit 75f2d0b
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 29 deletions.
6 changes: 4 additions & 2 deletions example/ping-pong.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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!");
}
Expand Down
26 changes: 0 additions & 26 deletions lib/src/client.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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'];
}
Expand All @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: discord_dart
version: 0.7.2
version: 0.7.3
description: A Discord library for Dart
author: Hackzzila <[email protected]>
homepage: https://github.com/Hackzzila/Discord-Dart
Expand Down

0 comments on commit 75f2d0b

Please sign in to comment.