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