chore: update es code to lapin

Signed-off-by: Zomatree <me@zomatree.live>
This commit is contained in:
Zomatree
2026-06-25 06:20:24 +01:00
parent 6a421dcd37
commit 553437e1df
30 changed files with 344 additions and 293 deletions

View File

@@ -1,4 +1,4 @@
use revolt_database::{util::reference::Reference, Database};
use revolt_database::{util::reference::Reference, Database, AMQP};
use revolt_result::{create_error, Result};
use rocket::State;
use rocket_empty::EmptyResponse;
@@ -10,6 +10,7 @@ use rocket_empty::EmptyResponse;
#[delete("/<webhook_id>/<token>/<message_id>")]
pub async fn webhook_delete_message(
db: &State<Database>,
amqp: &State<AMQP>,
webhook_id: Reference<'_>,
token: String,
message_id: Reference<'_>,
@@ -23,5 +24,5 @@ pub async fn webhook_delete_message(
return Err(create_error!(CannotDeleteMessage));
}
message.delete(db).await.map(|_| EmptyResponse)
message.delete(db, Some(amqp)).await.map(|_| EmptyResponse)
}

View File

@@ -2,6 +2,7 @@ use iso8601_timestamp::Timestamp;
use revolt_config::config;
use revolt_database::{
tasks::process_embeds::queue, util::reference::Reference, Database, Message, PartialMessage,
AMQP,
};
use revolt_models::v0::{self, DataEditMessage, Embed};
use revolt_models::validator::Validate;
@@ -15,6 +16,7 @@ use rocket::{serde::json::Json, State};
#[patch("/<webhook_id>/<token>/<message_id>", data = "<data>")]
pub async fn webhook_edit_message(
db: &State<Database>,
amqp: &State<AMQP>,
webhook_id: Reference<'_>,
token: String,
message_id: Reference<'_>,
@@ -73,7 +75,7 @@ pub async fn webhook_edit_message(
partial.embeds = Some(new_embeds);
message.update(db, partial, vec![]).await?;
message.update(db, Some(amqp), partial, vec![]).await?;
// Queue up a task for processing embeds
if let Some(content) = edit.content {