feat(GuildManager): Allow for more options for GuildManager.cre… (#3742)

* typings: add GuildVerificationLevel and GuildExplicitContentFilter

* implement new types

* fix jsdoc on stores

* typo

* add more options for GuildStore#create

* add channels and roles

* update typings

* fix typings and use snake case for permissionOverwrites

* typings & jsdoc

* fix tslint

* remove trailing whitespace

* fix jsdoc

* fix jsdoc

* fix oopsies

* fix lint

* fix lint

* fix mr lint man

* add typedefs and support for setting channel parents

* fix tab indenation

* update jsdoc

* suggested changes

* style: fix silly format

* docs(PartialChannelData): name is not optional

* style: remove silly format
This commit is contained in:
Sugden
2020-02-29 06:43:42 +00:00
committed by GitHub
parent 3d0c1df19d
commit 2ee0f1cdc6
6 changed files with 202 additions and 61 deletions

40
typings/index.d.ts vendored
View File

@@ -582,7 +582,9 @@ declare module 'discord.js' {
};
MessageTypes: MessageType[];
ActivityTypes: ActivityType[];
ExplicitContentFilterLevels: ExplicitContentFilterLevel[];
DefaultMessageNotifications: DefaultMessageNotifications[];
VerificationLevels: VerificationLevel[];
MembershipStates: 'INVITED' | 'ACCEPTED';
};
@@ -647,7 +649,7 @@ declare module 'discord.js' {
public embedChannelID: Snowflake | null;
public embedEnabled: boolean;
public emojis: GuildEmojiManager;
public explicitContentFilter: number;
public explicitContentFilter: ExplicitContentFilterLevel;
public features: GuildFeatures[];
public icon: string | null;
public id: Snowflake;
@@ -681,7 +683,7 @@ declare module 'discord.js' {
public systemChannelFlags: Readonly<SystemChannelFlags>;
public systemChannelID: Snowflake | null;
public vanityURLCode: string | null;
public verificationLevel: number;
public verificationLevel: VerificationLevel;
public readonly verified: boolean;
public readonly voice: VoiceState | null;
public readonly voiceStates: VoiceStateManager;
@@ -713,7 +715,7 @@ declare module 'discord.js' {
public setChannelPositions(channelPositions: ChannelPosition[]): Promise<Guild>;
public setDefaultMessageNotifications(defaultMessageNotifications: DefaultMessageNotifications | number, reason?: string): Promise<Guild>;
public setEmbed(embed: GuildEmbedData, reason?: string): Promise<Guild>;
public setExplicitContentFilter(explicitContentFilter: number, reason?: string): Promise<Guild>;
public setExplicitContentFilter(explicitContentFilter: ExplicitContentFilterLevel, reason?: string): Promise<Guild>;
public setIcon(icon: Base64Resolvable | null, reason?: string): Promise<Guild>;
public setName(name: string, reason?: string): Promise<Guild>;
public setOwner(owner: GuildMemberResolvable, reason?: string): Promise<Guild>;
@@ -722,7 +724,7 @@ declare module 'discord.js' {
public setSplash(splash: Base64Resolvable | null, reason?: string): Promise<Guild>;
public setSystemChannel(systemChannel: ChannelResolvable | null, reason?: string): Promise<Guild>;
public setSystemChannelFlags(systemChannelFlags: SystemChannelFlagsResolvable, reason?: string): Promise<Guild>;
public setVerificationLevel(verificationLevel: number, reason?: string): Promise<Guild>;
public setVerificationLevel(verificationLevel: VerificationLevel, reason?: string): Promise<Guild>;
public splashURL(options?: ImageURLOptions): string | null;
public toJSON(): object;
public toString(): string;
@@ -2179,6 +2181,8 @@ declare module 'discord.js' {
codeBlockContent?: boolean;
}
type ExplicitContentFilterLevel = 'DISABLED' | 'MEMBERS_WITHOUT_ROLES' | 'ALL_MEMBERS';
interface Extendable {
GuildEmoji: typeof GuildEmoji;
DMChannel: typeof DMChannel;
@@ -2303,8 +2307,8 @@ declare module 'discord.js' {
interface GuildEditData {
name?: string;
region?: string;
verificationLevel?: number;
explicitContentFilter?: number;
verificationLevel?: VerificationLevel;
explicitContentFilter?: ExplicitContentFilterLevel;
defaultMessageNotifications?: DefaultMessageNotifications | number;
afkChannel?: ChannelResolvable;
systemChannel?: ChannelResolvable;
@@ -2625,9 +2629,27 @@ declare module 'discord.js' {
};
interface PartialChannel extends Partialize<Channel> {}
interface PartialChannelData {
id?: number;
name: string;
topic?: string;
type?: ChannelType;
parentID?: number;
permissionOverwrites?: {
id: number | Snowflake;
type?: OverwriteType;
allow?: PermissionResolvable;
deny?: PermissionResolvable;
}[];
}
interface PartialGuildMember extends Partialize<GuildMember> {}
interface PartialMessage extends Partialize<Message> {}
interface PartialUser extends Partialize<User> {}
interface PartialRoleData extends RoleData {
id?: number;
}
type PartialTypes = 'USER'
| 'CHANNEL'
@@ -2635,6 +2657,8 @@ declare module 'discord.js' {
| 'MESSAGE'
| 'REACTION';
interface PartialUser extends Partialize<User> {}
type PresenceStatus = ClientPresenceStatus | 'offline';
type PresenceStatusData = ClientPresenceStatus | 'invisible';
@@ -2720,6 +2744,8 @@ declare module 'discord.js' {
type UserResolvable = User | Snowflake | Message | GuildMember;
type VerificationLevel = 'NONE' | 'LOW' | 'MEDIUM' | 'HIGH' | 'VERY_HIGH';
type VoiceStatus = number;
interface WebhookEditData {