(&self, arg: OpUpdateRoleFields)
| 1150 | |
| 1151 | #[allow(async_fn_in_trait)] |
| 1152 | async fn discord_update_role(&self, arg: OpUpdateRoleFields) -> Result<Role, anyhow::Error> { |
| 1153 | let rt_ctx = get_rt_ctx(&self.state); |
| 1154 | |
| 1155 | let role_id = parse_discord_id(&arg.role_id)?; |
| 1156 | |
| 1157 | let updated = discord_request_with_extra_error(&self.state, async move { |
| 1158 | let mut update_role = rt_ctx |
| 1159 | .discord_config |
| 1160 | .client |
| 1161 | .update_role(rt_ctx.guild_id, role_id); |
| 1162 | |
| 1163 | if let Some(color) = arg.color { |
| 1164 | update_role = update_role.color(color); |
| 1165 | } |
| 1166 | if let Some(colors) = arg.colors { |
| 1167 | update_role = update_role.colors(colors.map(Into::into)); |
| 1168 | } |
| 1169 | if let Some(hoist) = arg.hoist { |
| 1170 | update_role = update_role.hoist(hoist); |
| 1171 | } |
| 1172 | if let Some(mentionable) = arg.mentionable { |
| 1173 | update_role = update_role.mentionable(mentionable); |
| 1174 | } |
| 1175 | if let Some(name) = &arg.name { |
| 1176 | update_role = update_role.name(name.as_deref()); |
| 1177 | } |
| 1178 | if let Some(permissions) = arg.permissions { |
| 1179 | let parsed: u64 = permissions.parse()?; |
| 1180 | update_role = update_role.permissions(Permissions::from_bits_truncate(parsed)); |
| 1181 | } |
| 1182 | if let Some(unicode_emoji) = &arg.unicode_emoji { |
| 1183 | update_role = update_role.unicode_emoji(Some(&unicode_emoji)); |
| 1184 | } |
| 1185 | |
| 1186 | Ok(update_role.await) |
| 1187 | }) |
| 1188 | .await? |
| 1189 | .model() |
| 1190 | .await?; |
| 1191 | |
| 1192 | Ok(updated.into()) |
| 1193 | } |
| 1194 | |
| 1195 | #[allow(async_fn_in_trait)] |
| 1196 | async fn discord_update_role_positions( |
nothing calls this directly
no test coverage detected