addRole method

Future<void> addRole(
  1. Snowflake id,
  2. Snowflake roleId,
  3. {String? auditLogReason}
)

Add a role to a member in the guild.

Implementation

Future<void> addRole(Snowflake id, Snowflake roleId, {String? auditLogReason}) async {
  final route = HttpRoute()
    ..guilds(id: guildId.toString())
    ..members(id: id.toString())
    ..roles(id: roleId.toString());
  final request = BasicRequest(route, method: 'PUT', auditLogReason: auditLogReason);

  await client.httpHandler.executeSafe(request);
}