diff options
| author | Nathan Perry <np@npry.dev> | 2025-12-17 20:40:44 -0500 |
|---|---|---|
| committer | Nathan Perry <np@npry.dev> | 2025-12-17 21:13:46 -0500 |
| commit | de49f346313e7739945fbf0058bdfb78c90237a6 (patch) | |
| tree | 99528908ff7ca5f5a39b1a727650bf3a1ccad721 /src/util/mod.rs | |
| parent | 13fcc8a263970e48999e7f9319876a6443a54ac5 (diff) | |
update poise to not use custom fork
Diffstat (limited to 'src/util/mod.rs')
| -rw-r--r-- | src/util/mod.rs | 40 |
1 files changed, 17 insertions, 23 deletions
diff --git a/src/util/mod.rs b/src/util/mod.rs index 2035054..79ab2b5 100644 --- a/src/util/mod.rs +++ b/src/util/mod.rs @@ -1,15 +1,7 @@ -use std::{ - collections::HashMap, - process::Stdio, -}; - use chrono::Duration; use grate::tracing; use lazy_static::lazy_static; -use poise::{ - CreateReply, - FrameworkError, -}; +use poise::FrameworkError; use regex::{ Match, Regex, @@ -33,6 +25,10 @@ use serenity::{ permissions::Permissions, }, }; +use std::{ + collections::HashMap, + process::Stdio, +}; use tap::Pipe; use url::Url; @@ -92,10 +88,6 @@ pub fn err_msg<'a, U, E>(err: &'a FrameworkError<U, E>) -> Option<&'a Message> { msg, .. } - | NonCommandMessage { - msg, - .. - } | DynamicPrefix { msg, .. @@ -140,17 +132,19 @@ pub async fn send( pub async fn reply<U, E>( ctx: poise::Context<'_, U, E>, text: impl AsRef<str>, -) -> Result<poise::ReplyHandle<'_>, serenity::Error> { - let handle = poise::send_reply( - ctx, - CreateReply::default() - .tts(unwrap_tts(ctx)) - .content(text.as_ref()) - .allowed_mentions(Default::default()), - ) - .await?; +) -> anyhow::Result<()> { + let msg = msg(ctx).ok_or_else(|| anyhow::anyhow!("couldn't find referenced message"))?; + + let reply = CreateMessage::new() + .reference_message(msg) + .tts(msg.tts) + .content(text.as_ref()) + .allowed_mentions(Default::default()); - Ok(handle) + let channel = ctx.guild_channel().await.ok_or_else(|| anyhow::anyhow!("not in a guild"))?; + channel.send_message(ctx.http(), reply).await?; + + Ok(()) } #[inline] |
