fix(GuildAuditLogsEntry): correct mapped AuditLogChange objects
backport #10438 djs v14
This commit is contained in:
@@ -457,7 +457,12 @@ class GuildAuditLogsEntry {
|
||||
* Specific property changes
|
||||
* @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
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
export interface AuditLogChange {
|
||||
key: APIAuditLogChange['key'];
|
||||
old?: APIAuditLogChange['old_value'];
|
||||
new?: APIAuditLogChange['new_value'];
|
||||
}
|
||||
export type AuditLogChange = {
|
||||
[SourceElement in APIAuditLogChange as SourceElement['key']]: {
|
||||
key: SourceElement['key'];
|
||||
old?: SourceElement['old_value'];
|
||||
new?: SourceElement['new_value'];
|
||||
};
|
||||
}[APIAuditLogChange['key']];
|
||||
|
||||
export type Awaitable<T> = T | PromiseLike<T>;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user