fix: use regex for eta again

Signed-off-by: seth <getchoo@tuta.io>
This commit is contained in:
seth 2023-12-04 08:48:20 -05:00
parent 4bf3136364
commit 1c168bd8ba
No known key found for this signature in database
GPG key ID: D31BD0D494BBEE86

View file

@ -1,10 +1,14 @@
use crate::{consts, utils};
use color_eyre::eyre::Result;
use once_cell::sync::Lazy;
use poise::serenity_prelude::{Context, Message};
use regex::Regex;
pub async fn handle(ctx: &Context, message: &Message) -> Result<()> {
if !message.content.contains(" eta ") {
static ETA_REGEX: Lazy<Regex> = Lazy::new(|| Regex::new(r"\beta\b").unwrap());
pub async fn handle(ctx: &Context, msg: &Message) -> Result<()> {
if !ETA_REGEX.is_match(&msg.content) {
return Ok(());
}
@ -13,6 +17,6 @@ pub async fn handle(ctx: &Context, message: &Message) -> Result<()> {
utils::random_choice(consts::ETA_MESSAGES)?
);
message.reply(ctx, response).await?;
msg.reply(ctx, response).await?;
Ok(())
}