Skip to content

Commit

Permalink
fix: handle length sending message to tg properly
Browse files Browse the repository at this point in the history
  • Loading branch information
jiegec committed May 12, 2024
1 parent 26e8486 commit ea508bf
Showing 1 changed file with 22 additions and 9 deletions.
31 changes: 22 additions & 9 deletions server/src/bot.rs
Original file line number Diff line number Diff line change
Expand Up @@ -270,9 +270,10 @@ async fn create_pipeline_from_pr(
.await?;
}
Err(err) => {
bot.send_message(
msg.chat.id,
format!("Failed to create pipeline from pr: {err:?}"),
bot_send_message_handle_length(
&bot,
&msg,
&format!("Failed to create pipeline from pr: {err:?}"),
)
.await?;
}
Expand Down Expand Up @@ -756,21 +757,33 @@ pub async fn answer(bot: Bot, msg: Message, cmd: Command, pool: DbPool) -> Respo
.await
{
Ok((pr_number, url)) => {
bot.send_message(msg.chat.id, format!("Successfully opened PR: {url}"))
.await?;
bot_send_message_handle_length(
&bot,
&msg,
&format!("Successfully opened PR: {url}"),
)
.await?;

create_pipeline_from_pr(pool.clone(), pr_number, None, &msg, &bot)
.await?;
}
Err(e) => {
bot.send_message(msg.chat.id, format!("Failed to open PR: {}", e))
.await?;
bot_send_message_handle_length(
&bot,
&msg,
&format!("Failed to open PR: {:?}", e),
)
.await?;
}
}
}
Err(e) => {
bot.send_message(msg.chat.id, format!("Failed to find update: {}", e))
.await?;
bot_send_message_handle_length(
&bot,
&msg,
&format!("Failed to find update: {:?}", e),
)
.await?;
}
};
}
Expand Down

0 comments on commit ea508bf

Please sign in to comment.