Skip to content

Commit 9e71b7d

Browse files
committed
fix(structures): fix import ext, add CDN URLs, and use new flag check
2 parents 2a84a84 + c71228a commit 9e71b7d

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+1095
-110
lines changed

apps/guide/content/docs/voice/index.mdx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,13 +62,13 @@ After this, you'll be able to play Ogg and WebM Opus files without any other dep
6262
- [`@noble/ciphers`](https://www.npmjs.com/package/@noble/ciphers)
6363
- [`libsodium-wrappers`](https://www.npmjs.com/package/libsodium-wrappers)
6464

65-
#### DAVE Protocol Support
65+
#### DAVE Protocol Support for end-to-end encryption of voice audio
6666

67-
- [`@snazzah/davey`](https://www.npmjs.com/package/@snazzah/davey) - to enable end-to-end encryption with the DAVE protocol.
67+
- [`@snazzah/davey`](https://www.npmjs.com/package/@snazzah/davey)
6868

6969
<Callout>
70-
Some Discord clients already require the DAVE protocol for end-to-end encryption in voice chat. Ensure you have
71-
`@snazzah/davey` installed to avoid compatibility issues.
70+
At this time, `@snazzah/davey` is the only supported DAVE protocol library in this package, and comes pre-installed.
71+
In the future, we may support other libraries once they are created.
7272
</Callout>
7373

7474
<Callout>

packages/structures/src/automoderation/AutoModerationRule.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,14 +55,18 @@ export class AutoModerationRule<Omitted extends keyof APIAutoModerationRule | ''
5555
}
5656

5757
/**
58-
* The rule {@link https://discord.com/developers/docs/resources/auto-moderation#auto-moderation-rule-object-event-types | event type}
58+
* The rule event type
59+
*
60+
* @see {@link https://discord.com/developers/docs/resources/auto-moderation#auto-moderation-rule-object-event-types}
5961
*/
6062
public get eventType() {
6163
return this[kData].event_type;
6264
}
6365

6466
/**
65-
* The rule {@link https://discord.com/developers/docs/resources/auto-moderation#auto-moderation-rule-object-trigger-types | trigger type}
67+
* The rule trigger type
68+
*
69+
* @see {@link https://discord.com/developers/docs/resources/auto-moderation#auto-moderation-rule-object-trigger-types}
6670
*/
6771
public get triggerType() {
6872
return this[kData].trigger_type;

packages/structures/src/automoderation/actions/AutoModerationAction.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,9 @@ export class AutoModerationAction<Omitted extends keyof APIAutoModerationAction
2626
}
2727

2828
/**
29-
* The {@link https://discord.com/developers/docs/resources/auto-moderation#auto-moderation-action-object-action-types | action type}
29+
* The action type
30+
*
31+
* @see {@link https://discord.com/developers/docs/resources/auto-moderation#auto-moderation-action-object-action-types}
3032
*/
3133
public get type() {
3234
return this[kData].type;

packages/structures/src/bitfields/AttachmentFlagsBitField.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { BitField } from './BitField.js';
44
/**
55
* Data structure that makes it easy to interact with a {@link Attachment#flags} bitfield.
66
*/
7-
export class AttachmentFlagsBitField extends BitField<keyof AttachmentFlags> {
7+
export class AttachmentFlagsBitField extends BitField<keyof typeof AttachmentFlags> {
88
/**
99
* Numeric attachment flags.
1010
*/

packages/structures/src/bitfields/ChannelFlagsBitField.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { BitField } from './BitField.js';
44
/**
55
* Data structure that makes it easy to interact with a {@link (Channel:class).flags} bitfield.
66
*/
7-
export class ChannelFlagsBitField extends BitField<keyof ChannelFlags> {
7+
export class ChannelFlagsBitField extends BitField<keyof typeof ChannelFlags> {
88
/**
99
* Numeric guild channel flags.
1010
*/

packages/structures/src/bitfields/MessageFlagsBitField.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { BitField } from './BitField.js';
44
/**
55
* Data structure that makes it easy to interact with a {@link Message#flags} bitfield.
66
*/
7-
export class MessageFlagsBitField extends BitField<keyof MessageFlags> {
7+
export class MessageFlagsBitField extends BitField<keyof typeof MessageFlags> {
88
/**
99
* Numeric message flags.
1010
*/
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import { SKUFlags } from 'discord-api-types/v10';
2+
import { BitField } from './BitField.js';
3+
4+
/**
5+
* Data structure that makes it easy to interact with an {@link SKUFlags} bitfield.
6+
*/
7+
export class SKUFlagsBitField extends BitField<keyof typeof SKUFlags> {
8+
/**
9+
* Numeric SKU flags.
10+
*/
11+
public static override readonly Flags = SKUFlags;
12+
13+
public override toJSON() {
14+
return super.toJSON(true);
15+
}
16+
}

packages/structures/src/bitfields/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,4 @@ export * from './GuildMemberFlagsBitField.js';
66
export * from './GuildSystemChannelFlagsBitField.js';
77
export * from './MessageFlagsBitField.js';
88
export * from './PermissionsBitField.js';
9+
export * from './SKUFlagsBitField.js';

packages/structures/src/channels/Channel.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import type { APIChannel, APIPartialChannel, ChannelType, ChannelFlags } from 'd
33
import { Structure } from '../Structure.js';
44
import { ChannelFlagsBitField } from '../bitfields/ChannelFlagsBitField.js';
55
import { kData } from '../utils/symbols.js';
6-
import { isIdSet } from '../utils/type-guards.js';
6+
import { isFieldSet, isIdSet } from '../utils/type-guards.js';
77
import type { Partialize } from '../utils/types.js';
88
import type { ChannelPermissionMixin } from './mixins/ChannelPermissionMixin.js';
99
import type { ChannelWebhookMixin } from './mixins/ChannelWebhookMixin.js';
@@ -82,9 +82,9 @@ export class Channel<
8282
* to null, respecting Omit behaviors
8383
*/
8484
public get flags() {
85-
const flags =
86-
'flags' in this[kData] && typeof this[kData].flags === 'number' ? (this[kData].flags as ChannelFlags) : null;
87-
return flags ? new ChannelFlagsBitField(flags) : null;
85+
return isFieldSet(this[kData], 'flags', 'number')
86+
? new ChannelFlagsBitField(this[kData].flags as ChannelFlags)
87+
: null;
8888
}
8989

9090
/**

packages/structures/src/guild/Ban.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import type { APIBan } from 'discord-api-types/v10';
2-
import { Structure } from '../Structure';
3-
import { kData } from '../utils/symbols';
4-
import type { Partialize } from '../utils/types';
2+
import { Structure } from '../Structure.js';
3+
import { kData } from '../utils/symbols.js';
4+
import type { Partialize } from '../utils/types.js';
55

66
/**
77
* Represents a ban on Discord.

0 commit comments

Comments
 (0)