feat: reintroduce eta

Signed-off-by: seth <getchoo@tuta.io>
This commit is contained in:
TheKodeToad 2023-12-03 13:42:36 +00:00 committed by seth
parent 4b80ec7345
commit 358df91509
4 changed files with 43 additions and 4 deletions

View file

@ -11,3 +11,22 @@ pub static COLORS: Lazy<HashMap<&str, (u8, u8, u8)>> = Lazy::new(|| {
("orange", (251, 146, 60)),
])
});
pub const ETA_MESSAGES: [&str; 16] = [
"Sometime",
"Some day",
"Not far",
"The future",
"Never",
"Perhaps tomorrow?",
"There are no ETAs",
"No",
"Nah",
"Yes",
"Yas",
"Next month",
"Next year",
"Next week",
"In Prism Launcher 2.0.0",
"At the appropriate juncture, in due course, in the fullness of time",
];

View file

@ -6,7 +6,7 @@ use log::*;
use poise::serenity_prelude::Timestamp;
use poise::FrameworkError;
pub async fn handle(error: poise::FrameworkError<'_, Data, Report>) {
pub async fn handle(error: FrameworkError<'_, Data, Report>) {
match error {
FrameworkError::Setup { error, .. } => error!("Error setting up client!\n{error:#?}"),

18
src/handlers/event/eta.rs Normal file
View file

@ -0,0 +1,18 @@
use crate::{consts, utils};
use color_eyre::eyre::Result;
use poise::serenity_prelude::{Context, Message};
pub async fn handle_eta(ctx: &Context, message: &Message) -> Result<()> {
if !message.content.contains(" eta ") {
return Ok(());
}
let response = format!(
"{} <:pofat:1031701005559144458>",
utils::random_choice(consts::ETA_MESSAGES)?
);
message.reply(ctx, response).await?;
Ok(())
}

View file

@ -1,11 +1,13 @@
use crate::Data;
use color_eyre::eyre::{Report, Result};
use poise::serenity_prelude as serenity;
use poise::serenity_prelude::Context;
use poise::{Event, FrameworkContext};
mod eta;
pub async fn handle(
ctx: &serenity::Context,
ctx: &Context,
event: &Event<'_>,
framework: FrameworkContext<'_, Data, Report>,
data: &Data,
@ -15,7 +17,7 @@ pub async fn handle(
log::info!("Logged in as {}!", data_about_bot.user.name)
}
Event::Message { new_message } => {}
Event::Message { new_message } => eta::handle_eta(ctx, new_message).await?,
_ => {}
}