Compare commits
2 commits
01c2e47e88
...
46cbccca4e
Author | SHA1 | Date | |
---|---|---|---|
46cbccca4e | |||
59659bdbf8 |
3 changed files with 11 additions and 10 deletions
8
Cargo.lock
generated
8
Cargo.lock
generated
|
@ -605,18 +605,18 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "enum-iterator"
|
||||
version = "0.7.0"
|
||||
version = "0.8.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4eeac5c5edb79e4e39fe8439ef35207780a11f69c52cbe424ce3dfad4cb78de6"
|
||||
checksum = "2953d1df47ac0eb70086ccabf0275aa8da8591a28bd358ee2b52bd9f9e3ff9e9"
|
||||
dependencies = [
|
||||
"enum-iterator-derive",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "enum-iterator-derive"
|
||||
version = "0.7.0"
|
||||
version = "0.8.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c134c37760b27a871ba422106eedbb8247da973a09e82558bf26d619c882b159"
|
||||
checksum = "8958699f9359f0b04e691a13850d48b7de329138023876d07cbd024c2c820598"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
|
|
|
@ -8,7 +8,7 @@ include = ["src/main.rs"]
|
|||
[dependencies]
|
||||
anyhow = "1"
|
||||
clap = { version = "3", features = ["derive", "cargo"] }
|
||||
enum-iterator = "0.7"
|
||||
enum-iterator = "0.8"
|
||||
serde = { version = "1", features = ["derive"] }
|
||||
tokio = { version = "1", features = ["full"] }
|
||||
toml = "0.5"
|
||||
|
|
11
src/main.rs
11
src/main.rs
|
@ -82,8 +82,7 @@ async fn handle_login(user_id: OwnedUserId, password: &str) -> Result<()> {
|
|||
device_id: resp.device_id,
|
||||
user_id,
|
||||
}
|
||||
})
|
||||
.unwrap()
|
||||
})?
|
||||
);
|
||||
|
||||
Ok(())
|
||||
|
@ -91,7 +90,7 @@ async fn handle_login(user_id: OwnedUserId, password: &str) -> Result<()> {
|
|||
|
||||
async fn handle_run(config_path: PathBuf, crypto_store_path: PathBuf) -> Result<()> {
|
||||
let data = std::fs::read_to_string(config_path)?;
|
||||
let config: TomlConfig = toml::from_str(&data).unwrap();
|
||||
let config: TomlConfig = toml::from_str(&data)?;
|
||||
|
||||
let client = Client::builder()
|
||||
.user_id(&config.session.user_id)
|
||||
|
@ -270,7 +269,9 @@ async fn uwuify(room: Joined, message: &str) -> Result<()> {
|
|||
}
|
||||
|
||||
async fn get_previous_message(room: &Joined) -> Result<TextMessageEventContent> {
|
||||
let last_prev_batch = (**room).last_prev_batch().unwrap();
|
||||
let last_prev_batch = (**room)
|
||||
.last_prev_batch()
|
||||
.context("No previous batch key while trying to find previous message")?;
|
||||
let request = MessagesOptions::backward(&last_prev_batch);
|
||||
let messages = room.messages(request).await?;
|
||||
|
||||
|
@ -310,7 +311,7 @@ async fn help(room: Joined) -> Result<()> {
|
|||
msg.push_str(&command.to_string());
|
||||
msg.push_str(" - ");
|
||||
msg.push_str(command.help_text());
|
||||
msg.push_str("\n");
|
||||
msg.push('\n');
|
||||
}
|
||||
let content = RoomMessageEventContent::notice_plain(msg);
|
||||
room.send(content, None).await?;
|
||||
|
|
Loading…
Reference in a new issue