From f7a0c846b035a4ff7ad92fa804ed5397dcb069b1 Mon Sep 17 00:00:00 2001 From: Marcelo Borges Date: Mon, 10 Jun 2024 23:32:06 +0100 Subject: [PATCH] Adds push & run scripts. Fix help and version cmd --- scripts/push_image.sh | 8 ++++++++ scripts/run_telebot.sh | 5 +++++ src/main.rs | 8 ++++---- 3 files changed, 17 insertions(+), 4 deletions(-) create mode 100755 scripts/push_image.sh create mode 100755 scripts/run_telebot.sh diff --git a/scripts/push_image.sh b/scripts/push_image.sh new file mode 100755 index 0000000..15445a1 --- /dev/null +++ b/scripts/push_image.sh @@ -0,0 +1,8 @@ +#!/usr/bin/env bash + +SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) + +version="$("$SCRIPT_DIR/get_version.sh")" + +docker push jmarcelomb/telebot:latest +docker push "jmarcelomb/telebot:$version" diff --git a/scripts/run_telebot.sh b/scripts/run_telebot.sh new file mode 100755 index 0000000..7cb1249 --- /dev/null +++ b/scripts/run_telebot.sh @@ -0,0 +1,5 @@ +#!/usr/bin/env bash + +docker stop running_telebot +docker rm running_telebot +docker run --name running_telebot --env-file .env -d jmarcelomb/telebot:latest diff --git a/src/main.rs b/src/main.rs index b331844..aa9ab2d 100644 --- a/src/main.rs +++ b/src/main.rs @@ -102,14 +102,14 @@ async fn start(bot: Bot, dialogue: MyDialogue, msg: Message) -> HandlerResult { } async fn help(bot: Bot, msg: Message) -> HandlerResult { - let version = env!("CARGO_PKG_VERSION"); - bot.send_message(msg.chat.id, format!("Current version is: {} 🏷️", version)) + bot.send_message(msg.chat.id, Command::descriptions().to_string()) .await?; Ok(()) } async fn version(bot: Bot, msg: Message) -> HandlerResult { - bot.send_message(msg.chat.id, Command::descriptions().to_string()) + let version = env!("CARGO_PKG_VERSION"); + bot.send_message(msg.chat.id, format!("Current version is: {} 🏷️", version)) .await?; Ok(()) } @@ -175,7 +175,7 @@ async fn milk_price_command(bot: Bot, msg: Message) -> HandlerResult { match milk_price { Some(price) => { - bot.send_message(msg.chat.id, format!("Current milk price is '{}' €", price)) + bot.send_message(msg.chat.id, format!("Current milk price is: {} €", price)) .await?; Ok(()) }