fix: use regex for eta again
Signed-off-by: seth <getchoo@tuta.io>
This commit is contained in:
parent
4bf3136364
commit
1c168bd8ba
1 changed files with 7 additions and 3 deletions
|
@ -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(())
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue