Skip to content

Commit

Permalink
Merge pull request #17 from red-avtovo/dependabot/cargo/telegram-bot-…
Browse files Browse the repository at this point in the history
…0.8.0

Update telegram-bot requirement from 0.7.0 to 0.8.0
  • Loading branch information
red-avtovo authored Feb 13, 2021
2 parents ab00675 + 382fcf0 commit ece83d7
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 5 deletions.
7 changes: 5 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,7 @@ log = "0.4.8"
env_logger = "0.8.2"

job_scheduler = "1.2.1"
telegram-bot = "0.7.0"
telegram-bot-raw = "0.8.0"
telegram-bot = { git = "https://github.com/Mephistophiles/telegram-bot"}
transmission-rpc = "0.3.3"
url = "2.1.1"
rand = "0.8.3"
Expand All @@ -43,4 +42,8 @@ aes = "0.6.0"
ofb = "0.4.0"
base64 = "^0.13"

#urlencode
percent-encoding = "2.1.0"

#html parser
scraper = "0.12.0"
14 changes: 11 additions & 3 deletions src/router.rs
Original file line number Diff line number Diff line change
Expand Up @@ -95,13 +95,18 @@ async fn process_callback(api: Api, pool: &Pool, callback_query: CallbackQuery,
let user_id: &i64 = &callback_query.from.id.into();
let chat_ref = &callback_query.from.to_chat_ref();
let data = callback_query.data.clone();
let message = match callback_query.clone().message.unwrap() {
MessageOrChannelPost::Message(it) => it,
MessageOrChannelPost::ChannelPost(_) => return Ok(())
};

match data {
// download:magnet_uuid:directory_ordinal (1-64 bytes)
Some(ref value) if value.starts_with("download:") => start_download(&api, pool, user_id,value, chat_ref).await?,
// t_status:task_uuid
Some(ref value) if value.starts_with("t_status:") => update_task_status(&api, pool, user_id,value, &callback_query.clone().message.unwrap()).await?,
Some(ref value) if value.starts_with("t_status:") => update_task_status(&api, pool, user_id,value, &message).await?,
// t_remove:task_uuid
Some(ref value) if value.starts_with("t_remove:") => remove_task(&api, pool, user_id,value, &callback_query.clone().message.unwrap()).await?,
Some(ref value) if value.starts_with("t_remove:") => remove_task(&api, pool, user_id,value, &message).await?,
// static commands
Some(ref data_string) => match data_string.as_str() {
direcoties_commands::LIST_DIRECTORIES => list_directories(&api, pool, user_id, chat_ref).await?,
Expand All @@ -125,7 +130,10 @@ async fn process_callback(api: Api, pool: &Pool, callback_query: CallbackQuery,
match callback_query.message {
Some(_) if value.starts_with("t_status:") => {}
Some(_) if value.starts_with("t_remove:") => {},
Some(message) => hide_or_delete(&api, &message).await?,
Some(message) => match message {
MessageOrChannelPost::Message(it) => hide_or_delete(&api, &it).await?,
MessageOrChannelPost::ChannelPost(_) => {}
},
_ => {}
}
}
Expand Down

0 comments on commit ece83d7

Please sign in to comment.