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