fix(GuildAuditLogsEntry): correct mapped AuditLogChange objects
backport #10438 djs v14
This commit is contained in:
@@ -457,7 +457,12 @@ class GuildAuditLogsEntry {
|
|||||||
* Specific property changes
|
* Specific property changes
|
||||||
* @type {AuditLogChange[]}
|
* @type {AuditLogChange[]}
|
||||||
*/
|
*/
|
||||||
this.changes = data.changes?.map(c => ({ key: c.key, old: c.old_value, new: c.new_value })) ?? [];
|
this.changes =
|
||||||
|
data.changes?.map(change => ({
|
||||||
|
key: change.key,
|
||||||
|
...('old_value' in change ? { old: change.old_value } : {}),
|
||||||
|
...('new_value' in change ? { new: change.new_value } : {}),
|
||||||
|
})) ?? [];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The entry's id
|
* The entry's id
|
||||||
|
|||||||
12
typings/index.d.ts
vendored
12
typings/index.d.ts
vendored
@@ -5197,11 +5197,13 @@ export interface AutoModerationActionMetadataOptions extends Partial<Omit<AutoMo
|
|||||||
channel: GuildTextChannelResolvable | ThreadChannel;
|
channel: GuildTextChannelResolvable | ThreadChannel;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface AuditLogChange {
|
export type AuditLogChange = {
|
||||||
key: APIAuditLogChange['key'];
|
[SourceElement in APIAuditLogChange as SourceElement['key']]: {
|
||||||
old?: APIAuditLogChange['old_value'];
|
key: SourceElement['key'];
|
||||||
new?: APIAuditLogChange['new_value'];
|
old?: SourceElement['old_value'];
|
||||||
}
|
new?: SourceElement['new_value'];
|
||||||
|
};
|
||||||
|
}[APIAuditLogChange['key']];
|
||||||
|
|
||||||
export type Awaitable<T> = T | PromiseLike<T>;
|
export type Awaitable<T> = T | PromiseLike<T>;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user