diff options
Diffstat (limited to 'filamento/examples')
-rw-r--r-- | filamento/examples/example.rs | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/filamento/examples/example.rs b/filamento/examples/example.rs index d7c03e4..8119743 100644 --- a/filamento/examples/example.rs +++ b/filamento/examples/example.rs @@ -2,10 +2,10 @@ use std::{path::Path, str::FromStr, sync::Arc, time::Duration}; use filamento::{Client, db::Db, files::FileStore}; use jid::JID; -use tokio::io; +use tokio::io::{self, AsyncReadExt}; use tracing::info; -#[derive(Clone)] +#[derive(Clone, Debug)] pub struct Files; impl FileStore for Files { @@ -65,6 +65,12 @@ async fn main() { .change_nick(Some("britney".to_string())) .await .unwrap(); + let mut profile_pic = tokio::fs::File::open("files/britney_starbies.jpg") + .await + .unwrap(); + let mut data = Vec::new(); + profile_pic.read_to_end(&mut data).await.unwrap(); + client.change_avatar(Some(data)).await.unwrap(); info!("sending message"); client .send_message( |