feat(bot)!: Camelize the AuditLogEntry changes (#4403)

* feat(bot)!: Camelize the AuditLogEntry changes

* fix type errors
This commit is contained in:
Fleny
2025-08-29 11:02:33 +02:00
committed by GitHub
parent e94308c8f2
commit 304aacdba9
3 changed files with 6 additions and 3 deletions
@@ -1,11 +1,12 @@
import type { DiscordAuditLogEntry } from '@discordeno/types'
import { camelize } from '@discordeno/utils'
import type { Bot } from '../bot.js'
import type { AuditLogEntry } from './types.js'
export function transformAuditLogEntry(bot: Bot, payload: DiscordAuditLogEntry): AuditLogEntry {
const auditLogEntry = {
id: bot.transformers.snowflake(payload.id),
changes: payload.changes,
changes: camelize(payload.changes),
userId: payload.user_id ? bot.transformers.snowflake(payload.user_id) : undefined,
targetId: payload.target_id ? bot.transformers.snowflake(payload.target_id) : undefined,
actionType: payload.action_type,
@@ -1,11 +1,12 @@
import type { DiscordAuditLogEntry } from '@discordeno/types'
import { snakelize } from '@discordeno/utils'
import type { Bot } from '../../bot.js'
import type { AuditLogEntry } from '../types.js'
export function transformAuditLogEntryToDiscordAuditLogEntry(bot: Bot, payload: AuditLogEntry): DiscordAuditLogEntry {
return {
id: bot.transformers.reverse.snowflake(payload.id),
changes: payload.changes,
changes: snakelize(payload.changes),
user_id: payload.userId ? bot.transformers.reverse.snowflake(payload.userId) : null,
target_id: payload.targetId ? bot.transformers.reverse.snowflake(payload.targetId) : null,
action_type: payload.actionType,
+2 -1
View File
@@ -11,6 +11,7 @@ import type {
AutoModerationTriggerTypes,
BigString,
ButtonStyles,
Camelize,
ChannelTypes,
DefaultMessageNotificationLevels,
DiscordActivityInstanceResource,
@@ -295,7 +296,7 @@ export interface AuditLogEntry {
id: bigint
userId?: bigint
reason?: string
changes?: DiscordAuditLogChange[]
changes?: Camelize<DiscordAuditLogChange>[]
targetId?: bigint
actionType: AuditLogEvents
options?: OptionalAuditEntryInfo