Add Guild delete method (#15)

* Fix typo

* Add guild delete method

* Fix Shard crash on guild delete
This commit is contained in:
Robin B 2017-10-04 23:02:31 +02:00 committed by Hackzzila
parent 3ef9e16d03
commit d827ecdda6
3 changed files with 8 additions and 2 deletions

View file

@ -1,3 +1,3 @@
# Contributing
If you want to contribute, feel free to fork and make a PR. Please lint ant run `dartfmt` before opening a PR.
If you want to contribute, feel free to fork and make a PR. Please lint and run `dartfmt` before opening a PR.
And make sure to always make your PRs to `indev`.

View file

@ -285,4 +285,10 @@ class Guild {
});
return map;
}
/// Deletes the guild.
Future<Null> delete() async {
await this._client.http.send('DELETE', "/guilds/${this.id}");
return null;
}
}

View file

@ -195,7 +195,7 @@ class Shard {
break;
case 'GUILD_DELETE':
if (json['d']['unavailable']) {
if (json['d']['unavailable'] == true) {
new GuildUnavailableEvent._new(this._ws.client, json);
} else {
new GuildDeleteEvent._new(this._ws.client, json, this);