mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-13 10:03:31 +01:00
fix(structures): correctly check if flags are present (#11404)
* fix(structures): correctly check if flags are present * chore: isFieldSet type guard --------- Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
This commit is contained in:
@@ -4,7 +4,7 @@ import { Structure } from '../Structure.js';
|
||||
import { MessageFlagsBitField } from '../bitfields/MessageFlagsBitField.js';
|
||||
import { dateToDiscordISOTimestamp } from '../utils/optimization.js';
|
||||
import { kData, kEditedTimestamp } from '../utils/symbols.js';
|
||||
import { isIdSet } from '../utils/type-guards.js';
|
||||
import { isFieldSet, isIdSet } from '../utils/type-guards.js';
|
||||
import type { Partialize } from '../utils/types.js';
|
||||
|
||||
// TODO: missing substructures: application
|
||||
@@ -110,8 +110,9 @@ export class Message<Omitted extends keyof APIMessage | '' = 'edited_timestamp'
|
||||
* The flags of this message as a bit field
|
||||
*/
|
||||
public get flags() {
|
||||
const flags = this[kData].flags;
|
||||
return flags ? new MessageFlagsBitField(this[kData].flags as MessageFlags) : null;
|
||||
return isFieldSet(this[kData], 'flags', 'number')
|
||||
? new MessageFlagsBitField(this[kData].flags as MessageFlags)
|
||||
: null;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user