UNPKG

darkcord

Version:

A NodeJS Package to interact with Discord API

196 lines 5.67 kB
import { DataWithClient, DisplayUserAvatarOptions, KeysToCamelCase } from "../types/index"; import { APIGuildMember, APIThreadMember, RESTPatchAPIGuildMemberJSONBody, RESTPutAPIGuildBanJSONBody, ThreadMemberFlags } from "discord-api-types/v10"; import { Base } from "./Base"; import { BitField } from "./BitField"; import { ThreadChannel } from "./Channel"; import { Guild } from "./Guild"; import { Permissions } from "./Permission"; import { User } from "./User"; import { Role } from "./Role"; import { Cache } from "../cache/Cache"; export declare class UncachedClientMemberError extends Error { constructor(); } export declare class MemberRoles { guild: Guild; private _roles; cache: Cache<Role>; constructor(guild: Guild, roles: string[]); /** * Get the member role with the highest position * @returns */ get highest(): Role; /** * Compare the position of a member role with another guild role * @param roleId The member role id * @param otherRoleId The guild role id * @returns */ comparePositions(roleId: string, otherRoleId: string): number; [Symbol.iterator](): IterableIterator<Role>; toArray(): string[]; } export declare class Member extends Base { guild: Guild; /** * The member's guild avatar hash */ avatar: string | null | undefined; /** * Timestamp of when the time out will be removed; until then, they cannot interact with the guild */ communicationDisabledUntil: string | null | undefined; /** * The user this guild member represents */ user: User; /** * Whether the user is deafened in voice channels */ deaf: boolean; /** * When the user started boosting the guild */ premiumSince: number | null; /** * Whether the user has not yet passed the guild's Membership Screening requirements */ pending: boolean; /** * Member roles */ roles: MemberRoles; /** * Member permissions bitfield */ permissions: Permissions; /** * Whether the user is muted in voice channels */ mute: boolean; /** * This member's guild nickname */ nickname: string | null; /** * When the user joined the guild */ joinedAt: number | null; rawData: APIGuildMember; constructor(data: APIGuildMember, guild: Guild); /** * The current voice state of this member */ get voiceState(): import("./VoiceState").VoiceState | undefined; get manageable(): boolean; get bannable(): boolean; get kickable(): boolean; /** * The member's display name */ displayName(): string; /** * The member's guild avatar url * @param options * @returns */ avatarURL(options?: DisplayUserAvatarOptions): string | null; /** * The member's display avatar url * @param options options for display avatar url * @returns */ displayAvatarURL(options?: DisplayUserAvatarOptions): string; /** * Add a role to this member * @param roleId Id of role to be added * @param reason * @returns */ addRole(roleId: string, reason?: string): Promise<void>; /** * Remove a role to this member * @param roleId Id of role to be removed * @param reason * @returns */ removeRole(roleId: string, reason?: string): Promise<void>; /** * Ban this member from the guild * @param options * @param reason * @returns */ ban(options?: KeysToCamelCase<RESTPutAPIGuildBanJSONBody>, reason?: string): Promise<void>; edit(options: KeysToCamelCase<RESTPatchAPIGuildMemberJSONBody>, reason?: string): Promise<Member>; /** * Applies timeout to the member for a specified time * @param timeout * @param reason * @returns */ disableCommunicationUntil(timeout: number, reason?: string): Promise<Member>; toJSON(): { readonly createdAt: number; id: string; rawData: APIGuildMember; avatar: string | null | undefined; user: User; permissions: Permissions; guild: Guild; roles: MemberRoles; mute: boolean; deaf: boolean; communicationDisabledUntil: string | null | undefined; joinedAt: number | null; pending: boolean; premiumSince: number | null; }; } export declare class ThreadMember extends Base { /** * Thread guild */ guild: Guild; /** * An timestamp for when the member last joined */ joinTimestamp: number; /** * Member flags combined as a bitfield */ flags: BitField<ThreadMemberFlags, typeof ThreadMemberFlags>; /** * The thread of member is in */ thread: ThreadChannel; /** * The id of the thread */ threadId: string; constructor(data: DataWithClient<APIThreadMember>, thread: ThreadChannel); /** * The guild member associated with this thread member */ get guildMember(): Member | undefined; /** * The user associated with this this thread member */ get user(): User | undefined; toJSON(): { readonly createdAt: number; id: string; rawData: Record<string, any> & { id?: string | undefined; }; flags: BitField<ThreadMemberFlags, typeof ThreadMemberFlags>; readonly user: User | undefined; guild: Guild; readonly guildMember: Member | undefined; joinTimestamp: number; thread: ThreadChannel; threadId: string; }; } //# sourceMappingURL=Member.d.ts.map