connect method

void connect({
  1. bool selfMute = false,
  2. bool selfDeafen = false,
})

Connects client to channel

Implementation

void connect({bool selfMute = false, bool selfDeafen = false}) {
  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, this.id, selfMute: selfMute, selfDeafen: selfDeafen);
  } on Error {
    throw InvalidShardException._new("Cannot find shard for this channel!");
  }
}