setAfkChannel method

Future<void> setAfkChannel(
  1. VoiceChannel channel
)

Update the afk channel

final voiceChannel = guild.channels.cache.getOrFail('240561194958716924');
await guild.setAfkChannel(voiceChannel);

Implementation

Future<void> setAfkChannel (VoiceChannel channel) async {
  Response response = await ioc.use<DiscordApiHttpService>().patch(url: "/guilds/$id")
    .payload({ 'afk_channel_id': channel.id })
    .build();

  if (response.statusCode == 200) {
    _afkChannelId = channel.id;
  }
}