feat: Audit Logs (#466)

* fix: squash audit log branch changes

Signed-off-by: Zomatree <me@zomatree.live>

* feat: emoji edit + pronoun

Signed-off-by: Zomatree <me@zomatree.live>

* fix: use tokio instead of async-std

Signed-off-by: Zomatree <me@zomatree.live>

* feat: add slowmode to audit log

Signed-off-by: Zomatree <me@zomatree.live>

* chore: update comments on permissions

Signed-off-by: Zomatree <me@zomatree.live>

---------

Signed-off-by: Zomatree <me@zomatree.live>
This commit is contained in:
Zomatree
2026-07-13 21:39:28 +01:00
committed by GitHub
parent f60c8340f4
commit 502203d37c
57 changed files with 2014 additions and 150 deletions

View File

@@ -4,13 +4,15 @@ use revolt_database::{
get_user_voice_channel_in_server, remove_user_from_voice_channel, UserVoiceChannel,
VoiceClient,
},
Database, RemovalIntention, User,
AuditLogEntryAction, Database, RemovalIntention, User,
};
use revolt_permissions::{calculate_server_permissions, ChannelPermission};
use revolt_result::{create_error, Result};
use rocket::State;
use rocket_empty::EmptyResponse;
use crate::util::audit_log_reason::AuditLogReason;
/// # Kick Member
///
/// Removes a member from the server.
@@ -20,6 +22,7 @@ pub async fn kick(
db: &State<Database>,
voice_client: &State<VoiceClient>,
user: User,
reason: AuditLogReason,
server_id: Reference<'_>,
member_id: Reference<'_>,
) -> Result<EmptyResponse> {
@@ -49,6 +52,18 @@ pub async fn kick(
.remove(db, &server, RemovalIntention::Kick, false)
.await?;
AuditLogEntryAction::MemberKick {
user: member.id.user.clone(),
}
.insert(
db,
server.id.clone(),
reason,
user.id,
Some(member.id.user.clone()),
)
.await;
if let Some(channel_id) = get_user_voice_channel_in_server(member_id.id, &server.id).await? {
remove_user_from_voice_channel(
voice_client,