mirror of
https://github.com/discordeno/discordeno.git
synced 2026-09-17 08:47:22 +00:00
feat(bot)!: Camelize the AuditLogEntry changes (#4403)
* feat(bot)!: Camelize the AuditLogEntry changes * fix type errors
This commit is contained in:
@@ -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,
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user