-
-
Notifications
You must be signed in to change notification settings - Fork 4.1k
feat(structures): add guild and related structures #11394
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
keston-dev
wants to merge
15
commits into
discordjs:main
Choose a base branch
from
keston-dev:feat/guild-structure
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+2,005
−0
Open
Changes from all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
9456f26
feat(structures): add Guild structure
keston-dev 1854d9c
feat(structures): update casing and exports
keston-dev cef9509
feat(structures): add guild member and widgets
keston-dev b51846e
feat(structures): add createdAt and createdTimestamp to Guild
keston-dev 6d83aff
feat(structures): add integrations and bans
keston-dev 6bf4888
feat(structures): add templates and scheduled events
keston-dev 6a977d3
feat(structures): fix bitfields to use typeof and repair jsdoc links
keston-dev 9585ccc
feat(structures): add missing date and timestamp getters
keston-dev 40df6ad
feat(structures): remove createdAt and createdTimestamp from account
keston-dev c426b2e
Merge branch 'main' into feat/guild-structure
keston-dev d8c2adf
feat(structures): add req. changes, fix missing templates and getters
keston-dev 2a84a84
Merge remote-tracking branch 'origin/feat/guild-structure' into feat/…
keston-dev 9e71b7d
fix(structures): fix import ext, add CDN URLs, and use new flag check
keston-dev 48cad4e
fix(structures): remove jsdoc about default overrides
keston-dev e682914
fix(structures): add missing datatemplate and repair jsdoc
keston-dev File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
16 changes: 16 additions & 0 deletions
16
packages/structures/src/bitfields/GuildMemberFlagsBitField.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| import { GuildMemberFlags } from 'discord-api-types/v10'; | ||
| import { BitField } from './BitField.js'; | ||
|
|
||
| /** | ||
| * Data structure that makes it easy to interact with a {@link GuildMember#flags} bitfield. | ||
| */ | ||
| export class GuildMemberFlagsBitField extends BitField<keyof typeof GuildMemberFlags> { | ||
| /** | ||
| * Numeric guild member flags. | ||
| */ | ||
| public static override readonly Flags = GuildMemberFlags; | ||
|
|
||
| public override toJSON() { | ||
| return super.toJSON(true); | ||
| } | ||
| } |
16 changes: 16 additions & 0 deletions
16
packages/structures/src/bitfields/GuildSystemChannelFlagsBitField.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| import { GuildSystemChannelFlags } from 'discord-api-types/v10'; | ||
| import { BitField } from './BitField.js'; | ||
|
|
||
| /** | ||
| * Data structure that makes it easy to interact with a {@link Guild#systemChannelFlags} bitfield. | ||
| */ | ||
| export class GuildSystemChannelFlagsBitField extends BitField<keyof typeof GuildSystemChannelFlags> { | ||
| /** | ||
| * Numeric system channel flags. | ||
| */ | ||
| public static override readonly Flags = GuildSystemChannelFlags; | ||
|
|
||
| public override toJSON() { | ||
| return super.toJSON(true); | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| import type { APIBan } from 'discord-api-types/v10'; | ||
| import { Structure } from '../Structure.js'; | ||
| import { kData } from '../utils/symbols.js'; | ||
| import type { Partialize } from '../utils/types.js'; | ||
|
|
||
| /** | ||
| * Represents a ban on Discord. | ||
| * | ||
| * @typeParam Omitted - Specify the properties that will not be stored in the raw data field as a union, implement via `DataTemplate` | ||
| * @remarks has substructure `User`, which needs to be instantiated and stored by any extending classes using it. | ||
| */ | ||
| export class Ban<Omitted extends keyof APIBan | '' = ''> extends Structure<APIBan, Omitted> { | ||
| /** | ||
| * The template used for removing data from the raw data stored for each ban. | ||
| */ | ||
| public static override readonly DataTemplate: Partial<APIBan> = {}; | ||
|
|
||
| /** | ||
| * @param data - The raw data from the API for the ban. | ||
| */ | ||
| public constructor(data: Partialize<APIBan, Omitted>) { | ||
| super(data); | ||
| } | ||
|
|
||
| /** | ||
| * The reason for the ban. | ||
| */ | ||
| public get reason() { | ||
| return this[kData].reason; | ||
| } | ||
| } | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.