Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
16 changes: 16 additions & 0 deletions packages/structures/src/bitfields/GuildMemberFlagsBitField.ts
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);
}
}
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);
}
}
2 changes: 2 additions & 0 deletions packages/structures/src/bitfields/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ export * from './BitField.js';

export * from './AttachmentFlagsBitField.js';
export * from './ChannelFlagsBitField.js';
export * from './GuildMemberFlagsBitField.js';
export * from './GuildSystemChannelFlagsBitField.js';
export * from './MessageFlagsBitField.js';
export * from './PermissionsBitField.js';
export * from './SKUFlagsBitField.js';
31 changes: 31 additions & 0 deletions packages/structures/src/guild/Ban.ts
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;
}
}
Loading