diff options
Diffstat (limited to 'src/commands/meme/create.rs')
| -rw-r--r-- | src/commands/meme/create.rs | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/commands/meme/create.rs b/src/commands/meme/create.rs index 2cd9465..160de7b 100644 --- a/src/commands/meme/create.rs +++ b/src/commands/meme/create.rs @@ -72,7 +72,7 @@ pub async fn addmeme(ctx: &Context, msg: &Message, args: Args) -> CommandResult if let Some(att) = image { let data = att.download().await?; - image_id = Some(Image::create(&mut conn, &att.filename, data, msg.author.id.get())?); + image_id = Some(Image::create(&mut conn, &att.filename, data, msg.author.id.get()).await?); }; let save_result = NewMeme { @@ -83,6 +83,7 @@ pub async fn addmeme(ctx: &Context, msg: &Message, args: Args) -> CommandResult metadata_id: 0, } .save(&mut conn, msg.author.id.get()) + .await .map(|_| {}); use diesel::result::DatabaseErrorKind; @@ -182,7 +183,7 @@ pub async fn addaudiomeme(ctx: &Context, msg: &Message, args: Args) -> CommandRe if let Ok(att) = image_att { let data = att.download().await?; - image_id = Image::create(&mut conn, &att.filename, data, msg.author.id.get())?.pipe(Some); + image_id = Image::create(&mut conn, &att.filename, data, msg.author.id.get())?.await.pipe(Some); } let mut audio_data = Vec::new(); @@ -196,7 +197,7 @@ pub async fn addaudiomeme(ctx: &Context, msg: &Message, args: Args) -> CommandRe .await; } - let audio_id = Audio::create(&mut conn, audio_data, msg.author.id.get())?; + let audio_id = Audio::create(&mut conn, audio_data, msg.author.id.get()).await?; let save_result = NewMeme { title, @@ -206,6 +207,7 @@ pub async fn addaudiomeme(ctx: &Context, msg: &Message, args: Args) -> CommandRe metadata_id: 0, } .save(&mut conn, msg.author.id.get()) + .await .map(|_| {}); use diesel::result::DatabaseErrorKind; |
