feat: reintroduce message link embeds

Signed-off-by: seth <getchoo@tuta.io>
This commit is contained in:
seth 2023-12-04 08:22:38 -05:00
parent 604a81fb44
commit 640409f2e2
No known key found for this signature in database
GPG key ID: D31BD0D494BBEE86
6 changed files with 160 additions and 94 deletions

View file

@ -0,0 +1,28 @@
use color_eyre::eyre::{eyre, Context as _, Result};
use poise::serenity_prelude::{Context, Message};
use crate::utils;
pub async fn handle(ctx: &Context, msg: &Message) -> Result<()> {
let embeds = utils::resolve_message(ctx, msg).await?;
// TOOD getchoo: actually reply to user
// ...not sure why Message doesn't give me a builder in reply() or equivalents
let our_channel = msg
.channel(ctx)
.await
.wrap_err_with(|| "Couldn't get channel from message!")?
.guild()
.ok_or_else(|| eyre!("Couldn't convert to GuildChannel!"))?;
if !embeds.is_empty() {
our_channel
.send_message(ctx, |m| {
m.set_embeds(embeds)
.allowed_mentions(|am| am.replied_user(false))
})
.await?;
}
Ok(())
}