Skip to content
Open
Show file tree
Hide file tree
Changes from 32 commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
5b704b9
feat: message structures
Qjuh Jul 12, 2025
c150c7a
fix: docs
Qjuh Jul 12, 2025
ee1ea3b
chore: components and more
Qjuh Jul 14, 2025
a457ab0
feat: embed and more
Qjuh Jul 15, 2025
c7c952a
feat: more substructures and code review suggestions
Qjuh Oct 5, 2025
9f55c9b
Merge branch 'main' into feat/more-structures
Qjuh Oct 5, 2025
f9f4778
Merge branch 'main' into feat/more-structures
Qjuh Oct 9, 2025
e9ed899
chore: tests and date conversions
Qjuh Oct 10, 2025
ac1d255
chore: jsdoc strings
Qjuh Oct 10, 2025
17cf74b
fix: tests
Qjuh Oct 10, 2025
65387e5
fix: tests
Qjuh Oct 10, 2025
3e7884e
feat: hexColor getters
Qjuh Oct 11, 2025
c3bae20
chore: remove getters for nested data
Qjuh Oct 12, 2025
a5cc011
chore: apply suggestions from code review
Qjuh Oct 19, 2025
2b639f1
fix: burst_colors in toJSON
Qjuh Oct 19, 2025
d6fda4c
docs: rephrase SectionBuilder remark
Qjuh Oct 20, 2025
79082d4
chore: add LabelComponent
Qjuh Oct 20, 2025
c99a5b9
Merge branch 'main' into feat/more-structures
Qjuh Oct 20, 2025
25ae08a
fix: add name and size to file component
Qjuh Oct 22, 2025
f062fbb
Merge branch 'main' into feat/more-structures
Qjuh Oct 22, 2025
ee515c7
chore: move resolved interaction data to interactions dir
Qjuh Oct 22, 2025
7b9db51
fix: code review
Qjuh Oct 24, 2025
671352c
chore: bump discord-api-types
Qjuh Oct 24, 2025
f3f6e16
Merge branch 'main' into feat/more-structures
Qjuh Oct 24, 2025
11d255c
chore: apply code review suggestions
Qjuh Oct 26, 2025
9d6a157
fix: lockfile
Qjuh Oct 26, 2025
c14ada7
chore: update remark
Qjuh Oct 26, 2025
0b94c45
fix: missing export
Qjuh Oct 27, 2025
761bb0b
chore: code review and tests
Qjuh Oct 29, 2025
056177a
Merge branch 'main' into feat/more-structures
Qjuh Oct 29, 2025
cb4014f
Merge branch 'main' into feat/more-structures
Jiralite Nov 2, 2025
e2754e3
build: fix file
Jiralite Nov 2, 2025
05dbf74
fix: typo
Jiralite Nov 2, 2025
7c105da
fix: missing toJSON
Qjuh Nov 2, 2025
fae3e1d
fix: remove redundant patch overrides
Qjuh Nov 2, 2025
d33b8dc
chore: missing component suffix
Qjuh Nov 2, 2025
7c79dfe
chore: better name
Qjuh Nov 2, 2025
66ff0f4
Merge branch 'main' into feat/more-structures
Qjuh Nov 6, 2025
e569a99
Merge branch 'main' into feat/more-structures
Qjuh Nov 12, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/structures/__tests__/channels.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ import {
TextChannel,
ThreadMetadata,
VoiceChannel,
} from '../src/index.js';
} from '../src/channels/index.js';
import { kData } from '../src/utils/symbols.js';

describe('text channel', () => {
Expand Down
17 changes: 9 additions & 8 deletions packages/structures/__tests__/invite.test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import type { APIExtendedInvite, APIInvite } from 'discord-api-types/v10';
import { InviteTargetType, InviteType } from 'discord-api-types/v10';
import { describe, expect, test } from 'vitest';
import { Invite } from '../src/index.js';
import { Invite } from '../src/invites/Invite.js';
import { dateToDiscordISOTimestamp } from '../src/utils/optimization.js';
import { kPatch } from '../src/utils/symbols.js';

describe('Invite', () => {
Expand All @@ -22,7 +23,7 @@ describe('Invite', () => {

const dataExtended: Omit<APIExtendedInvite, 'expires_at'> = {
...data,
created_at: '2020-10-10T13:50:17.209Z',
created_at: '2020-10-10T13:50:17.209000+00:00',
max_age: 12,
max_uses: 34,
temporary: false,
Expand Down Expand Up @@ -54,7 +55,7 @@ describe('Invite', () => {
const instance = new Invite(dataExtended);
expect(instance.type).toBe(data.type);
expect(instance.code).toBe(dataExtended.code);
expect(instance.createdAt?.toISOString()).toBe(dataExtended.created_at);
expect(dateToDiscordISOTimestamp(instance.createdAt!)).toBe(dataExtended.created_at);
expect(instance.createdTimestamp).toBe(Date.parse(dataExtended.created_at));
expect(instance.maxAge).toBe(dataExtended.max_age);
expect(instance.maxUses).toBe(dataExtended.max_uses);
Expand All @@ -63,10 +64,10 @@ describe('Invite', () => {
expect(instance.targetType).toBe(dataExtended.target_type);
expect(instance.temporary).toBe(dataExtended.temporary);
expect(instance.uses).toBe(dataExtended.uses);
expect(instance.expiresTimestamp).toStrictEqual(Date.parse('2020-10-10T13:50:29.209Z'));
expect(instance.expiresAt).toStrictEqual(new Date('2020-10-10T13:50:29.209Z'));
expect(instance.expiresTimestamp).toStrictEqual(Date.parse('2020-10-10T13:50:29.209000+00:00'));
expect(instance.expiresAt).toStrictEqual(new Date('2020-10-10T13:50:29.209000+00:00'));
expect(instance.url).toBe('https://discord.gg/123');
expect(instance.toJSON()).toEqual({ ...dataExtended, expires_at: '2020-10-10T13:50:29.209Z' });
expect(instance.toJSON()).toEqual({ ...dataExtended, expires_at: '2020-10-10T13:50:29.209000+00:00' });
});

test('Invite with omitted properties', () => {
Expand All @@ -79,8 +80,8 @@ describe('Invite', () => {
});

test('Invite with expiration', () => {
const instance = new Invite({ ...dataExtended, expires_at: '2020-10-10T13:50:29.209Z' });
expect(instance.toJSON()).toEqual({ ...dataExtended, expires_at: '2020-10-10T13:50:29.209Z' });
const instance = new Invite({ ...dataExtended, expires_at: '2020-10-10T13:50:29.209000+00:00' });
expect(instance.toJSON()).toEqual({ ...dataExtended, expires_at: '2020-10-10T13:50:29.209000+00:00' });
});

test('Patching Invite works in place', () => {
Expand Down
Loading