refraction/src/handlers/event/expand_link.rs
TheKodeToad c6f4295d6a feat: log analysis
Signed-off-by: seth <getchoo@tuta.io>
2023-12-12 16:02:06 -05:00

28 lines
845 B
Rust

use color_eyre::eyre::{eyre, Context as _, Result};
use poise::serenity_prelude::{Context, Message};
use crate::utils;
pub async fn handle(ctx: &Context, message: &Message) -> Result<()> {
let embeds = utils::resolve_message(ctx, message).await?;
// TOOD getchoo: actually reply to user
// ...not sure why Message doesn't give me a builder in reply() or equivalents
let our_channel = message
.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(())
}