timeout method

Future<void> timeout(
  1. DateTime expiration
)

Excludes this for a pre-defined period.

Note: An exclusion cannot exceed 28 days.

See documentation

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

Implementation

Future<void> timeout (DateTime expiration) async {
  Response response = await ioc.use<DiscordApiHttpService>().patch(url: '/guilds/${guild.id}/members/${user.id}')
    .payload({ 'communication_disabled_until': expiration.toIso8601String() })
    .build();

  if (response.statusCode == 200 || response.statusCode == 204) {
    _timeoutDuration = expiration.toIso8601String();
  }
}