Skip to content

Commit

Permalink
chore: format files
Browse files Browse the repository at this point in the history
  • Loading branch information
Massolari committed Mar 1, 2024
1 parent 5ef1098 commit 7629278
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 21 deletions.
10 changes: 6 additions & 4 deletions src/reddit_to_telegram.gleam
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,9 @@ fn start(
|> filter_low_score(10)

io.println(
"Sending messages to telegram channel " <> bridge.telegram_channel <> "...",
"Sending messages to telegram channel "
<> bridge.telegram_channel
<> "...",
)
let #(inserted, errors) =
filtered_posts
Expand All @@ -95,9 +97,9 @@ fn start(

io.println(
inserted
|> list.length
|> int.to_string
<> " messages sent",
|> list.length
|> int.to_string
<> " messages sent",
)

let _ = database.add_messages(database, inserted, bridge.telegram_channel)
Expand Down
31 changes: 14 additions & 17 deletions src/telegram.gleam
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,8 @@ fn send_video(
|> request.set_header("Content-Length", int.to_string(form.length))
|> request.set_header(
"Content-Type",
"multipart/form-data; boundary=" <> form.boundary,
"multipart/form-data; boundary="
<> form.boundary,
)
|> hackney.send_bits
|> result.map_error(fn(e) {
Expand All @@ -232,11 +233,11 @@ fn send_video(

Error(
"Error from server while sending video, HTTP status: "
<> int.to_string(status)
<> case bit_array.to_string(response.body) {
Ok(body) -> " " <> body
Error(_) -> ""
},
<> int.to_string(status)
<> case bit_array.to_string(response.body) {
Ok(body) -> " " <> body
Error(_) -> ""
},
)
}
}
Expand All @@ -249,11 +250,7 @@ fn send_animation(
chat_id: String,
data: AppData,
) -> Result(String, String) {
send_json(
"sendAnimation",
animation_encode(url, post, chat_id),
post_id,
data,
send_json("sendAnimation", animation_encode(url, post, chat_id), post_id, data,
)
}

Expand Down Expand Up @@ -319,12 +316,12 @@ fn text_encode(post: reddit.Post, chat_id: String) {
"text",
json.string(
post.title
<> external_url
<> text
<> "\n\n"
<> reddit.short_link(post)
<> "\n\n"
<> chat_id_as_link(chat_id),
<> external_url
<> text
<> "\n\n"
<> reddit.short_link(post)
<> "\n\n"
<> chat_id_as_link(chat_id),
),
),
parse_mode_json_field(),
Expand Down

0 comments on commit 7629278

Please sign in to comment.