refactor: Strengthen channel typings in appropriate places (#6232)

This commit is contained in:
Jiralite
2021-07-31 09:52:41 +01:00
committed by GitHub
parent 82daee576a
commit 65ae06429d
9 changed files with 70 additions and 41 deletions

38
typings/index.d.ts vendored
View File

@@ -593,7 +593,7 @@ export class Guild extends AnonymousGuild {
public fetchWidget(): Promise<Widget>;
public fetchWidgetSettings(): Promise<GuildWidgetSettings>;
public leave(): Promise<Guild>;
public setAFKChannel(afkChannel: ChannelResolvable | null, reason?: string): Promise<Guild>;
public setAFKChannel(afkChannel: VoiceChannelResolvable | null, reason?: string): Promise<Guild>;
public setAFKTimeout(afkTimeout: number, reason?: string): Promise<Guild>;
public setBanner(banner: Base64Resolvable | null, reason?: string): Promise<Guild>;
public setChannelPositions(channelPositions: readonly ChannelPosition[]): Promise<Guild>;
@@ -610,11 +610,11 @@ export class Guild extends AnonymousGuild {
public setName(name: string, reason?: string): Promise<Guild>;
public setOwner(owner: GuildMemberResolvable, reason?: string): Promise<Guild>;
public setPreferredLocale(preferredLocale: string, reason?: string): Promise<Guild>;
public setPublicUpdatesChannel(publicUpdatesChannel: ChannelResolvable | null, reason?: string): Promise<Guild>;
public setPublicUpdatesChannel(publicUpdatesChannel: TextChannelResolvable | null, reason?: string): Promise<Guild>;
public setRolePositions(rolePositions: readonly RolePosition[]): Promise<Guild>;
public setRulesChannel(rulesChannel: ChannelResolvable | null, reason?: string): Promise<Guild>;
public setRulesChannel(rulesChannel: TextChannelResolvable | null, reason?: string): Promise<Guild>;
public setSplash(splash: Base64Resolvable | null, reason?: string): Promise<Guild>;
public setSystemChannel(systemChannel: ChannelResolvable | null, reason?: string): Promise<Guild>;
public setSystemChannel(systemChannel: TextChannelResolvable | null, reason?: string): Promise<Guild>;
public setSystemChannelFlags(systemChannelFlags: SystemChannelFlagsResolvable, reason?: string): Promise<Guild>;
public setVerificationLevel(verificationLevel: VerificationLevel | number, reason?: string): Promise<Guild>;
public setWidgetSettings(settings: GuildWidgetSettingsData, reason?: string): Promise<Guild>;
@@ -705,7 +705,7 @@ export class GuildChannel extends Channel {
public permissionsFor(memberOrRole: GuildMember | Role): Readonly<Permissions>;
public permissionsFor(memberOrRole: GuildMemberResolvable | RoleResolvable): Readonly<Permissions> | null;
public setName(name: string, reason?: string): Promise<this>;
public setParent(channel: CategoryChannel | Snowflake | null, options?: SetParentOptions): Promise<this>;
public setParent(channel: CategoryChannelResolvable | null, options?: SetParentOptions): Promise<this>;
public setPosition(position: number, options?: SetChannelPositionOptions): Promise<this>;
public setTopic(topic: string | null, reason?: string): Promise<this>;
public isText(): this is TextChannel | NewsChannel;
@@ -1415,7 +1415,7 @@ export class Role extends Base {
public delete(reason?: string): Promise<Role>;
public edit(data: RoleData, reason?: string): Promise<Role>;
public equals(role: Role): boolean;
public permissionsIn(channel: ChannelResolvable): Readonly<Permissions>;
public permissionsIn(channel: GuildChannel | Snowflake): Readonly<Permissions>;
public setColor(color: ColorResolvable, reason?: string): Promise<Role>;
public setHoist(hoist: boolean, reason?: string): Promise<Role>;
public setMentionable(mentionable: boolean, reason?: string): Promise<Role>;
@@ -1885,7 +1885,7 @@ export class VoiceState extends Base {
public setDeaf(deaf: boolean, reason?: string): Promise<GuildMember>;
public setMute(mute: boolean, reason?: string): Promise<GuildMember>;
public kick(reason?: string): Promise<GuildMember>;
public setChannel(channel: ChannelResolvable | null, reason?: string): Promise<GuildMember>;
public setChannel(channel: VoiceChannelResolvable | null, reason?: string): Promise<GuildMember>;
public setRequestToSpeak(request: boolean): Promise<void>;
public setSuppressed(suppressed: boolean): Promise<void>;
}
@@ -2901,7 +2901,7 @@ export interface ChannelData {
nsfw?: boolean;
bitrate?: number;
userLimit?: number;
parentId?: Snowflake | null;
parent?: CategoryChannelResolvable | null;
rateLimitPerUser?: number;
lockPermissions?: boolean;
permissionOverwrites?: readonly OverwriteResolvable[] | Collection<Snowflake, OverwriteResolvable>;
@@ -2919,7 +2919,7 @@ export interface ChannelLogsQueryOptions {
export type ChannelMention = `<#${Snowflake}>`;
export interface ChannelPosition {
channel: ChannelResolvable;
channel: GuildChannel | Snowflake;
lockPermissions?: boolean;
parent?: CategoryChannelResolvable | null;
position?: number;
@@ -3517,7 +3517,7 @@ export interface GuildChannelCreateOptions {
| ChannelTypes.GUILD_PRIVATE_THREAD
>;
nsfw?: boolean;
parent?: ChannelResolvable;
parent?: CategoryChannelResolvable;
bitrate?: number;
userLimit?: number;
rateLimitPerUser?: number;
@@ -3557,8 +3557,8 @@ export interface GuildEditData {
verificationLevel?: VerificationLevel | number;
explicitContentFilter?: ExplicitContentFilterLevel | number;
defaultMessageNotifications?: DefaultMessageNotificationLevel | number;
afkChannel?: ChannelResolvable;
systemChannel?: ChannelResolvable;
afkChannel?: VoiceChannelResolvable;
systemChannel?: TextChannelResolvable;
systemChannelFlags?: SystemChannelFlagsResolvable;
afkTimeout?: number;
icon?: Base64Resolvable;
@@ -3566,8 +3566,8 @@ export interface GuildEditData {
splash?: Base64Resolvable;
discoverySplash?: Base64Resolvable;
banner?: Base64Resolvable;
rulesChannel?: ChannelResolvable;
publicUpdatesChannel?: ChannelResolvable;
rulesChannel?: TextChannelResolvable;
publicUpdatesChannel?: TextChannelResolvable;
preferredLocale?: string;
description?: string | null;
features?: GuildFeatures[];
@@ -3623,7 +3623,7 @@ export interface GuildMemberEditData {
roles?: Collection<Snowflake, Role> | readonly RoleResolvable[];
mute?: boolean;
deaf?: boolean;
channel?: ChannelResolvable | null;
channel?: GuildVoiceChannelResolvable | null;
}
export type GuildMemberResolvable = GuildMember | UserResolvable;
@@ -3651,6 +3651,8 @@ export interface GuildSearchMembersOptions {
export type GuildTemplateResolvable = string;
export type GuildVoiceChannelResolvable = VoiceChannel | StageChannel | Snowflake;
export type HexColorString = `#${string}`;
export interface HTTPAttachmentData {
@@ -4310,6 +4312,8 @@ export type TextBasedChannelTypes =
| 'GUILD_PUBLIC_THREAD'
| 'GUILD_PRIVATE_THREAD';
export type TextChannelResolvable = Snowflake | TextChannel;
export type ThreadAutoArchiveDuration = 60 | 1440 | 4320 | 10080;
export type ThreadChannelResolvable = ThreadChannel | Snowflake;
@@ -4364,6 +4368,8 @@ export type VerificationLevel = keyof typeof VerificationLevels;
export type VoiceBasedChannelTypes = 'GUILD_VOICE' | 'GUILD_STAGE_VOICE';
export type VoiceChannelResolvable = Snowflake | VoiceChannel;
export type WebhookClientData = WebhookClientDataIdWithToken | WebhookClientDataURL;
export interface WebhookClientDataIdWithToken {
@@ -4383,7 +4389,7 @@ export type WebhookClientOptions = Pick<
export interface WebhookEditData {
name?: string;
avatar?: BufferResolvable;
channel?: ChannelResolvable;
channel?: GuildTextChannelResolvable;
}
export type WebhookEditMessageOptions = Pick<