Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
701 changes: 390 additions & 311 deletions Cargo.lock

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ name = "tgcli"
path = "src/main.rs"

[dependencies]
grammers-client = { version = "0.8", features = ["fs", "markdown", "html"] }
grammers-session = "0.8"
grammers-tl-types = "0.8"
grammers-mtsender = "0.8"
grammers-client = { version = "0.10", features = ["fs", "markdown", "html"] }
grammers-session = "0.10"
grammers-tl-types = "0.10"
grammers-mtsender = "0.10"
turso = "0.4"
clap = { version = "4", features = ["derive"] }
clap_complete = "4"
Expand Down
10 changes: 6 additions & 4 deletions src/app/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ pub mod send;
pub mod sync;

use crate::store::Store;
use crate::tg::TgClient;
use crate::tg::{peer_to_ref_async, TgClient};
use crate::Cli;
use anyhow::{Context, Result};
use grammers_session::defs::PeerRef;
use grammers_session::types::PeerRef;
use grammers_session::updates::UpdatesLike;
use grammers_tl_types as tl;
use tokio::sync::mpsc;
Expand Down Expand Up @@ -34,6 +34,7 @@ impl App {
// SqliteSession::open creates the file if it doesn't exist

let (tg, updates_rx) = TgClient::connect_with_updates(&session_path)
.await
.context("Failed to connect to Telegram")?;

if !tg
Expand Down Expand Up @@ -62,6 +63,7 @@ impl App {
let session_path = format!("{}/session.db", store_dir);

let (tg, updates_rx) = TgClient::connect_with_updates(&session_path)
.await
.context("Failed to connect to Telegram")?;
Ok(App {
tg,
Expand Down Expand Up @@ -137,8 +139,8 @@ impl App {
format!("Failed to iterate dialogs while resolving chat {}", chat_id)
})? {
let peer = dialog.peer();
if peer.id().bare_id() == chat_id {
return Ok(PeerRef::from(peer));
if peer.id().bare_id() == Some(chat_id) {
return peer_to_ref_async(peer).await;
}
}
anyhow::bail!(
Expand Down
Loading