disconnect method

void disconnect()

Disconnects use from channel.

Implementation

void disconnect() {
  if (this.client is! Nyxx) {
    throw new UnsupportedError("Cannot connect with NyxxRest");
  }

  try {
    final shard = (this.client as Nyxx).shardManager.shards.firstWhere((element) => element.guilds.contains(this.guild.id));

    shard.changeVoiceState(this.guild.id, null);
  } on Error {
    throw InvalidShardException._new("Cannot find shard for this channel!");
  }
}