setDeaf method

Future<void> setDeaf(
  1. bool value
)

Deafens or not a server member

Example :

final member = guild.members.cache.get('240561194958716924');

if (member != null) {
  await member.setDeaf(true);
}

Implementation

Future<void> setDeaf(bool value) async {
  final Response response = await ioc.use<HttpService>().patch(
    url: '/guilds/$_guildId/members/$_memberId',
    payload: {'deaf': value}
  );

  if (response.statusCode == 204 || response.statusCode == 200) {
    _isDeaf = value;
    return;
  }

  ioc.use<MineralCli>().console.error('Unable to ${value ? 'deaf' : 'undeaf'} user #$_memberId');
}