Skip to content

Commit

Permalink
Make prnouncer work with the new inline threads
Browse files Browse the repository at this point in the history
  • Loading branch information
AshCorr committed Jan 9, 2024
1 parent f7c799f commit 165c68c
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 23 deletions.
34 changes: 13 additions & 21 deletions Cargo.lock

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

3 changes: 2 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,5 @@ log = "0.4.14"
simple_logger = "2.1.0"
anyhow = "1.0.53"
getset = "0.1.2"
chrono = { version = "0.4.19", features = ["serde"] }
chrono = { version = "0.4.19", features = ["serde"] }
url = "2.5.0"
6 changes: 5 additions & 1 deletion src/google.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use anyhow::{Context, Result};
use serde::{Deserialize, Serialize};
use url::Url;

#[derive(Serialize, Deserialize, Debug)]
pub struct GoogleChatMessage {
Expand All @@ -16,8 +17,11 @@ impl GoogleChatMessage {
webhook_url: &String,
thread_key: &String,
) -> Result<GoogleChatMessage> {
let webhook_url = Url::parse_with_params(webhook_url,
&[("messageReplyOption", "REPLY_MESSAGE_FALLBACK_TO_NEW_THREAD"), ("threadKey", thread_key)])?;

let response = reqwest::Client::new()
.post(webhook_url.replace("{threadKey}", thread_key))
.post(webhook_url.as_str())
.body(serde_json::to_string(&self)?)
.header("User-Agent", "GU-PR-Bot")
.send()
Expand Down

0 comments on commit 165c68c

Please sign in to comment.