feat: reintroduce message link embeds
Signed-off-by: seth <getchoo@tuta.io>
This commit is contained in:
parent
604a81fb44
commit
640409f2e2
6 changed files with 160 additions and 94 deletions
28
src/handlers/event/expand_link.rs
Normal file
28
src/handlers/event/expand_link.rs
Normal 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(())
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue