timeout method

Future<void> timeout(
  1. DateTime expiration
)

Excludes this for a pre-defined period

Note: An exclusion cannot exceed 28 days

See documentation

Example :

final DateTime = DateTime.now().add(Duration(days: 28));
await member.timeout(DateTime);

Implementation

Future<void> timeout (DateTime expiration) async {
  // @Todo add ADMINISTRATOR permission or is the owner of the guild constraint

  Response response = await ioc.use<HttpService>().patch(url: '/guilds/${guild.id}/members/${user.id}', payload: { 'communication_disabled_until': expiration.toIso8601String() });
  if (response.statusCode == 200 || response.statusCode == 204) {
    _timeoutDuration = expiration;
  }
}