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 13:39:28 -07:00
committed by GitHub
parent f60c8340f4
commit 502203d37c
57 changed files with 2014 additions and 150 deletions
+159 -4
View File
@@ -1423,6 +1423,14 @@ impl From<FieldsMessage> for crate::FieldsMessage {
}
}
impl From<crate::VoiceInformation> for VoiceInformation {
fn from(value: crate::VoiceInformation) -> Self {
VoiceInformation {
max_users: value.max_users,
}
}
}
impl From<VoiceInformation> for crate::VoiceInformation {
fn from(value: VoiceInformation) -> Self {
crate::VoiceInformation {
@@ -1431,10 +1439,151 @@ impl From<VoiceInformation> for crate::VoiceInformation {
}
}
impl From<crate::VoiceInformation> for VoiceInformation {
fn from(value: crate::VoiceInformation) -> Self {
VoiceInformation {
max_users: value.max_users,
impl From<crate::AuditLogEntryAction> for AuditLogEntryAction {
fn from(value: crate::AuditLogEntryAction) -> Self {
match value {
crate::AuditLogEntryAction::MessageDelete { author, channel } => {
AuditLogEntryAction::MessageDelete { author, channel }
}
crate::AuditLogEntryAction::BanCreate { user } => {
AuditLogEntryAction::BanCreate { user }
}
crate::AuditLogEntryAction::BanDelete { user } => {
AuditLogEntryAction::BanDelete { user }
}
crate::AuditLogEntryAction::ChannelCreate { channel, name } => {
AuditLogEntryAction::ChannelCreate { channel, name }
}
crate::AuditLogEntryAction::MemberEdit {
user,
before,
after,
} => AuditLogEntryAction::MemberEdit {
user,
before: before.into(),
after: after.into(),
},
crate::AuditLogEntryAction::MemberKick { user } => {
AuditLogEntryAction::MemberKick { user }
}
crate::AuditLogEntryAction::ServerEdit { before, after } => {
AuditLogEntryAction::ServerEdit {
before: before.into(),
after: after.into(),
}
}
crate::AuditLogEntryAction::RoleEdit {
role,
before,
after,
} => AuditLogEntryAction::RoleEdit {
role,
before: before.into(),
after: after.into(),
},
crate::AuditLogEntryAction::RoleCreate { role, name } => {
AuditLogEntryAction::RoleCreate { role, name }
}
crate::AuditLogEntryAction::RoleDelete { role, name } => {
AuditLogEntryAction::RoleDelete { role, name }
}
crate::AuditLogEntryAction::RolesReorder { before, after } => {
AuditLogEntryAction::RolesReorder { before, after }
}
crate::AuditLogEntryAction::MessageBulkDelete { channel, count } => {
AuditLogEntryAction::MessageBulkDelete { channel, count }
}
crate::AuditLogEntryAction::ChannelEdit {
channel,
before,
after,
} => AuditLogEntryAction::ChannelEdit {
channel,
before: before.into(),
after: after.into(),
},
crate::AuditLogEntryAction::ChannelRolePermissionsEdit {
channel,
role,
permissions,
} => AuditLogEntryAction::ChannelRolePermissionsEdit {
channel,
role,
permissions: permissions.into(),
},
crate::AuditLogEntryAction::ChannelDelete { channel, name } => {
AuditLogEntryAction::ChannelDelete { channel, name }
}
crate::AuditLogEntryAction::InviteDelete { invite, channel } => {
AuditLogEntryAction::InviteDelete { invite, channel }
}
crate::AuditLogEntryAction::WebhookCreate {
webhook,
name,
channel,
} => AuditLogEntryAction::WebhookCreate {
webhook,
name,
channel,
},
crate::AuditLogEntryAction::WebhookDelete {
webhook,
name,
channel,
} => AuditLogEntryAction::WebhookDelete {
webhook,
name,
channel,
},
crate::AuditLogEntryAction::EmojiCreate { emoji, name } => {
AuditLogEntryAction::EmojiCreate { emoji, name }
}
crate::AuditLogEntryAction::EmojiUpdate {
emoji,
before,
after,
} => AuditLogEntryAction::EmojiUpdate {
emoji,
before: before.into(),
after: after.into(),
},
crate::AuditLogEntryAction::EmojiDelete { emoji, name } => {
AuditLogEntryAction::EmojiDelete { emoji, name }
}
crate::AuditLogEntryAction::MessagePin {
message,
author,
channel,
} => AuditLogEntryAction::MessagePin {
message,
author,
channel,
},
crate::AuditLogEntryAction::MessageUnpin {
message,
author,
channel,
} => AuditLogEntryAction::MessageUnpin {
message,
author,
channel,
},
crate::AuditLogEntryAction::InviteCreate { invite, channel } => {
AuditLogEntryAction::InviteCreate { invite, channel }
}
}
}
}
impl From<crate::AuditLogEntry> for AuditLogEntry {
fn from(value: crate::AuditLogEntry) -> Self {
AuditLogEntry {
id: value.id,
server: value.server,
reason: value.reason,
user: value.user,
target: value.target,
action: value.action.into(),
}
}
}
@@ -1527,3 +1676,9 @@ impl From<WebPushSubscription> for crate::WebPushSubscription {
}
}
}
impl From<crate::PartialEmoji> for PartialEmoji {
fn from(value: crate::PartialEmoji) -> Self {
PartialEmoji { name: value.name }
}
}