feat: answer atm
This commit is contained in:
parent
8600ecf7ee
commit
3c8a456b2c
5
.vscode/settings.json
vendored
5
.vscode/settings.json
vendored
@ -11,9 +11,12 @@
|
||||
"gitlens.plusFeatures.enabled": false,
|
||||
"editor.guides.bracketPairs": true,
|
||||
"cSpell.words": [
|
||||
"actix",
|
||||
"clickhouse",
|
||||
"datalake",
|
||||
"openapi",
|
||||
"utoipa",
|
||||
"uuid",
|
||||
"Uuid"
|
||||
],
|
||||
]
|
||||
}
|
||||
|
@ -50,7 +50,7 @@ pub async fn init_api(config: Config, pool: Arc<PoolManager>, http: Arc<Http>) -
|
||||
.bind((Ipv4Addr::UNSPECIFIED, port))
|
||||
.map_err(|e| {
|
||||
error!("Failed to bind API server: {}", e);
|
||||
})?
|
||||
})?
|
||||
.run()
|
||||
.await
|
||||
.map_err(|e| {
|
||||
|
@ -5,7 +5,7 @@ use database::{
|
||||
trivial_question::TrivialQuestion,
|
||||
trivial_round::TrivialRound,
|
||||
};
|
||||
use poise::serenity_prelude::{self as serenity, ActivityData, FullEvent};
|
||||
use poise::serenity_prelude::{self as serenity, ActivityData, CreateMessage, FullEvent};
|
||||
use tracing::{info, span, Instrument};
|
||||
|
||||
pub async fn event_handler(
|
||||
@ -131,6 +131,18 @@ pub async fn event_handler(
|
||||
*new_message.timestamp,
|
||||
));
|
||||
inserter.write(&trivia_round.clone()).await?;
|
||||
let optimize = TrivialRound::optimize_table_sql();
|
||||
match manager_pool.execute_with_retry(&optimize).await {
|
||||
Ok(_) => {}
|
||||
Err(e) => {
|
||||
tracing::error!("Failed to optimize trivia round table: {}", e);
|
||||
}
|
||||
}
|
||||
let builder = CreateMessage::new()
|
||||
.content("Answer taken into account!")
|
||||
.reference_message(new_message)
|
||||
.flags(serenity::MessageFlags::EPHEMERAL);
|
||||
channel_id.send_message(&ctx.http, builder).await?;
|
||||
Ok(())
|
||||
}
|
||||
.instrument(span!(
|
||||
|
Loading…
Reference in New Issue
Block a user