setMute method

Future<void> setMute(
  1. bool value
)

Mutes or unmute a server member

Example :

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

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

Implementation

Future<void> setMute(bool value) async {

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

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

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