Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/cangrebot.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ pub async fn set_daily(
challenge: DailyChallenge,
client: &Client,
) {
let req = json!({
let request = json!({
"title": format!("Reto #{day} - {}", challenge.question.title),
"message": challenge.to_string(),
"tag_name": challenge.question.difficulty.to_string(),
Expand All @@ -21,7 +21,7 @@ pub async fn set_daily(
.post(endpoint)
.header("content-type", "application/json")
.header("Authorization", apikey)
.body(serde_json::to_string(&req).unwrap())
.body(serde_json::to_string(&request).unwrap())
.send()
.await
.inspect_err(|e| console_warn!("Reqwest Error: {e:?}"))
Expand Down
4 changes: 2 additions & 2 deletions src/challenge.rs
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ impl Display for DailyChallenge {
.unwrap_or_default();

f.write_fmt(format_args!(
r#"{parsed}
r"{parsed}

> Enlace:
> https://leetcode.com{}
Expand All @@ -104,7 +104,7 @@ impl Display for DailyChallenge {
> {test_cases}

{code}
"#,
",
self.link
))
}
Expand Down
4 changes: 2 additions & 2 deletions src/daily.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use crate::challenge::{DailyChallenge, GraphQLResponse};

const LETCODE_URL: &str = "https://leetcode.com";

const DAILY_QUERY: &str = r#"query {
const DAILY_QUERY: &str = r"query {
activeDailyCodingChallengeQuestion {
date
link
Expand All @@ -30,7 +30,7 @@ const DAILY_QUERY: &str = r#"query {
sampleTestCase
}
}
}"#;
}";

// Strategy to fetch from https://github.com/JacobLinCool/LeetCode-Query
pub async fn get_daily(client: &Client) -> DailyChallenge {
Expand Down
2 changes: 2 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ mod cangrebot;
mod challenge;
mod daily;

/// # Panics
/// This may panic if the environment variable `APIKEY` is not found, or if `CANGREBOT_API_ENDPOINT` is also missing.
#[event(scheduled)]
pub async fn main(_e: ScheduledEvent, env: Env, _ctx: ScheduleContext) {
// Custom panic
Expand Down
Loading