This commit is contained in:
2026-03-29 19:59:55 +00:00
parent 97cdbdec0b
commit a6932b1b0b
5 changed files with 14 additions and 4 deletions
+1 -1
View File
@@ -67,7 +67,7 @@ impl Retrive {
let mut summary_string: String = String::new();
for x in map {
summary_string.push_str(format!("#{} | {} \n", x.0, x.1).as_str());
summary_string.push_str(format!("- <#{}> | {} Messages \n", x.0, x.1).as_str());
}
let embed = CreateEmbed::new()
+9 -2
View File
@@ -1,6 +1,7 @@
use std::error::Error;
use entities::{channel, content, members, messages, server};
use migration::prelude::{DateTime, Utc};
use sea_orm::{ActiveModelTrait, ColumnTrait, DatabaseConnection, EntityTrait, QueryFilter};
use serenity::all::{Context, Message};
@@ -34,11 +35,16 @@ pub async fn log_message(
let channel_id = msg.channel(&ctx.http).await.unwrap().id().get() as i64;
let channel = channel::Model::get_or_create(channel_id, db).await?;
let timestamp_msg = msg.timestamp.naive_utc();
let timestamp: DateTime<Utc> =
DateTime::from_timestamp_secs(timestamp_msg.and_utc().timestamp()).unwrap();
println!(
"{}, {}, {}, {}, {}",
"{}, {}, {}, {}, {}, {}",
msg.id.get(),
member,
server,
timestamp,
content,
channel
);
@@ -46,11 +52,12 @@ pub async fn log_message(
let activeModel = messages::ActiveModel {
id: sea_orm::ActiveValue::NotSet,
id_discord: sea_orm::ActiveValue::Set(msg.id.get() as i64),
timestamp: sea_orm::ActiveValue::Set(timestamp),
id_sender: sea_orm::ActiveValue::Set(member),
id_server: sea_orm::ActiveValue::Set(server),
id_content: sea_orm::ActiveValue::Set(content),
id_channel: sea_orm::ActiveValue::Set(channel),
};
activeModel.insert(db).await;
activeModel.insert(db).await?;
Ok(())
}
+1 -1
View File
@@ -30,7 +30,7 @@ impl EventHandler for Bot {
println!("Error sending message: {why:?}");
}
}
log_message(&self.db, &ctx, msg).await;
log_message(&self.db, &ctx, msg).await.unwrap();
}
async fn interaction_create(&self, ctx: Context, interaction: Interaction) {
if let Interaction::Command(command) = interaction {