diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/commands/mod.rs | 5 | ||||
| -rw-r--r-- | src/util/mod.rs | 40 |
2 files changed, 20 insertions, 25 deletions
diff --git a/src/commands/mod.rs b/src/commands/mod.rs index a5ee1bd..97a1abe 100644 --- a/src/commands/mod.rs +++ b/src/commands/mod.rs @@ -1,4 +1,4 @@ -use poise::builtins::PrettyHelpConfiguration; +use poise::builtins::HelpConfiguration; use crate::{ PoiseContext, @@ -42,7 +42,8 @@ pub fn commands() -> Vec<poise::Command<crate::PoiseData, anyhow::Error>> { /// Print this help text. #[poise::command(prefix_command, aliases("halp"))] pub async fn help(ctx: PoiseContext<'_>, command: Option<String>) -> anyhow::Result<()> { - poise::builtins::pretty_help(ctx, command.as_deref(), PrettyHelpConfiguration { + poise::builtins::help(ctx, command.as_deref(), HelpConfiguration { + include_description: true, ..Default::default() }) .await?; 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] |
