Skip to content

Commit

Permalink
Bump actions/checkout from 1 to 3 (#6)
Browse files Browse the repository at this point in the history
Signed-off-by: Leo Lu <[email protected]>
  • Loading branch information
leoleoasd committed Mar 15, 2023
2 parents f6de564 + 45a5c8c commit 3295d13
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/clippy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ jobs:
clippy_check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: actions/checkout@v3
- run: rustup component add clippy
- uses: actions-rs/clippy-check@v1
with:
Expand Down
16 changes: 9 additions & 7 deletions telegram_bot/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ async fn main() {
.dependencies(dptree::deps![cfg_params])
// If no handler succeeded to handle an update, this closure will be called.
.default_handler(|upd| async move {
log::warn!("Unhandled update: {:?}", upd);
log::debug!("Unhandled update: {:?}", upd);
})
// If the dispatcher fails for some reason, execute this handler.
.error_handler(LoggingErrorHandler::with_custom_text(
Expand Down Expand Up @@ -338,8 +338,7 @@ async fn handle_cmd(_cfg: ConfigParams, bot: Bot, msg: Message, cmd: Command) ->
"\n\ncookie is the `_U` cookie of [www.bing.com](https://www.bing.com). Do NOT include `_U=`.\n\
\nIn private chat, the bot responds to messages directly.\n\
In group, the bot only responds to messages mentioning (at) it.\n\
In both cases, reply to message of the latest response to continue a conversation.\n\
"
In both cases, reply to message of the latest response to continue a conversation."
);
#[allow(deprecated)]
bot.send_message(msg.chat.id, help_msg)
Expand All @@ -350,15 +349,18 @@ async fn handle_cmd(_cfg: ConfigParams, bot: Bot, msg: Message, cmd: Command) ->
let cookie = cookie.trim().to_string();
let mut id2cookie = CHATID_COOKIE.lock().await;
id2cookie.insert(msg.chat.id, cookie.clone());
tokio::spawn(bot.delete_message(msg.chat.id, msg.id).send());
log::info!("Cookie update: {} : {}.", msg.chat.id, cookie);
#[allow(deprecated)]
let id_future = bot
.send_message(msg.chat.id, "Your cookie is updated.")
.reply_to_message_id(msg.id)
.send_message(
msg.chat.id,
format!("Your cookie is updated to `{cookie}`."),
)
.parse_mode(ParseMode::Markdown);
bot.delete_message(msg.chat.id, msg.id).send().await?;
tokio::spawn(async move {
let msg_id = id_future.await?.id;
tokio::time::sleep(time::Duration::from_secs(5)).await;
tokio::time::sleep(time::Duration::from_secs(3)).await;
bot.delete_message(msg.chat.id, msg_id).send().await?;
Ok::<(), anyhow::Error>(())
});
Expand Down

0 comments on commit 3295d13

Please sign in to comment.