Skip to content

Commit 9249040

Browse files
committed
fix(remind): add role id comparison for role match
1 parent d74cecb commit 9249040

1 file changed

Lines changed: 8 additions & 4 deletions

File tree

crates/rustmail/src/commands/add_reminder/text_command/add_reminder.rs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -160,16 +160,20 @@ async fn parse_roles_and_content(
160160
let mut all_roles_valid = !potential_role_names.is_empty();
161161

162162
for role_name in &potential_role_names {
163+
let role_id = role_name
164+
.chars()
165+
.filter(|c| c.is_ascii_digit())
166+
.collect::<String>();
167+
163168
if role_name.is_empty() {
164169
all_roles_valid = false;
165170
break;
166171
}
167172

168173
let role_name_lower = role_name.to_lowercase();
169-
let found = guild
170-
.roles
171-
.values()
172-
.find(|r| r.name.to_lowercase() == role_name_lower);
174+
let found = guild.roles.values().find(|r| {
175+
r.name.to_lowercase() == role_name_lower || r.id.get().to_string() == *role_id
176+
});
173177

174178
if let Some(role) = found {
175179
found_role_ids.push(role.id.get());

0 commit comments

Comments
 (0)