Skip to content

Commit

Permalink
fix thread_ts
Browse files Browse the repository at this point in the history
  • Loading branch information
randommm committed Jul 22, 2023
1 parent 00e1f59 commit 37ea983
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/routes/pages.rs
Original file line number Diff line number Diff line change
Expand Up @@ -129,8 +129,14 @@ async fn process_slack_events(
};
print!("From user {user} at channel {channel} and type {type_}, received message: {text}. ");

let thread_ts = event.get("event_ts").ok_or("event_ts not found on query")?;
let thread_ts = thread_ts.as_str().ok_or("event_ts is not a string")?;
let thread_ts = event.get("thread_ts");
let thread_ts = match thread_ts {
Some(x) => x,
None => event
.get("event_ts")
.ok_or("neither thread_ts nor event_ts found")?,
};
let thread_ts = thread_ts.as_str().ok_or("thread_ts is not a string")?;

let text = match Regex::new(r" ?<@.*> ?") {
Ok(pattern) if type_ == "app_mention" => {
Expand Down

0 comments on commit 37ea983

Please sign in to comment.