Skip to content

Commit

Permalink
ignore missions starting with $
Browse files Browse the repository at this point in the history
  • Loading branch information
BrettMayson committed Jun 16, 2024
1 parent ace4907 commit 50a7319
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 12 deletions.
3 changes: 3 additions & 0 deletions bin/bot/src/discord/slash/missions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,9 @@ async fn load(
.reply("Required option not provided: mission")
.await;
};
if mission_id.starts_with('$') {
return interaction.reply("Mission ID cannot start with `$`").await;
}
let Ok(Ok((Response::FetchMissionList(Ok(missions)), _))) = events_request_2!(
bootstrap::NC::get().await,
synixe_events::missions::db,
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion bin/db/src/handler/missions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,8 @@ impl Handler for Request {
(
LOWER(m.name) LIKE LOWER($1) OR
LOWER(m.id) LIKE LOWER($1)
)
) AND
m.id !~ '^\\$'
GROUP BY m.id
ORDER BY m.name ASC"#,
format!("%{search}%"),
Expand Down
18 changes: 9 additions & 9 deletions bin/executor/src/handler/missions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -128,25 +128,25 @@ impl Handler for Request {
} else if let Some(event) = match minutes {
// Warn the mission will change 80 minutes before it starts
78..=82 => {
if scheduled.mission == "$SUBCON$" {
if scheduled.mission.starts_with('$') {
None
} else {
Some(synixe_events::missions::publish::Publish::WarnChangeMission {
id: scheduled.mission.clone(),
mission_type: scheduled.typ,
})
id: scheduled.mission.clone(),
mission_type: scheduled.typ,
})
}
}
// Change the mission 70 minutes before it starts
68..=72 => {
if scheduled.mission == "$SUBCON$" {
if scheduled.mission.starts_with('$') {
None
} else {
Some(synixe_events::missions::publish::Publish::ChangeMission {
id: scheduled.mission.clone(),
mission_type: scheduled.typ,
reason: "Scheduled".to_string(),
})
id: scheduled.mission.clone(),
mission_type: scheduled.typ,
reason: "Scheduled".to_string(),
})
}
}
_ => None,
Expand Down

0 comments on commit 50a7319

Please sign in to comment.