mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-10 00:23:30 +01:00
docs: document constructors of extendible structures (#3160)
* docs: document constructors of extendible structures * docs(ClientPresence): document default value for data parameter Co-Authored-By: SpaceEEC <spaceeec@yahoo.com> * docs(Presence): document default value for data parameter Co-Authored-By: SpaceEEC <spaceeec@yahoo.com> * docs(DMChannel): capitalize DM in the constructor doc
This commit is contained in:
@@ -6,6 +6,10 @@ const { ActivityTypes, OPCodes } = require('../util/Constants');
|
||||
const { TypeError } = require('../errors');
|
||||
|
||||
class ClientPresence extends Presence {
|
||||
/**
|
||||
* @param {Client} client The instantiating client
|
||||
* @param {Object} [data={}] The data for the client presence
|
||||
*/
|
||||
constructor(client, data = {}) {
|
||||
super(client, Object.assign(data, { status: 'online', user: { id: null } }));
|
||||
}
|
||||
|
||||
@@ -10,6 +10,10 @@ const MessageStore = require('../stores/MessageStore');
|
||||
* @implements {TextBasedChannel}
|
||||
*/
|
||||
class DMChannel extends Channel {
|
||||
/**
|
||||
* @param {Client} client The instantiating client
|
||||
* @param {Object} data The data for the DM channel
|
||||
*/
|
||||
constructor(client, data) {
|
||||
super(client, data);
|
||||
// Override the channel type so partials have a known type
|
||||
|
||||
@@ -26,6 +26,10 @@ const { Error, TypeError } = require('../errors');
|
||||
* @extends {Base}
|
||||
*/
|
||||
class Guild extends Base {
|
||||
/**
|
||||
* @param {Client} client The instantiating client
|
||||
* @param {Object} data The data for the guild
|
||||
*/
|
||||
constructor(client, data) {
|
||||
super(client);
|
||||
|
||||
|
||||
@@ -14,6 +14,10 @@ const { Error, TypeError } = require('../errors');
|
||||
* @extends {Channel}
|
||||
*/
|
||||
class GuildChannel extends Channel {
|
||||
/**
|
||||
* @param {Guild} guild The guild the guild channel is part of
|
||||
* @param {Object} data The data for the guild channel
|
||||
*/
|
||||
constructor(guild, data) {
|
||||
super(guild.client, data);
|
||||
|
||||
|
||||
@@ -10,6 +10,11 @@ const Emoji = require('./Emoji');
|
||||
* @extends {Emoji}
|
||||
*/
|
||||
class GuildEmoji extends Emoji {
|
||||
/**
|
||||
* @param {Client} client The instantiating client
|
||||
* @param {Object} data The data for the guild emoji
|
||||
* @param {Guild} guild The guild the guild emoji is part of
|
||||
*/
|
||||
constructor(client, data, guild) {
|
||||
super(client, data);
|
||||
|
||||
|
||||
@@ -15,6 +15,11 @@ const { Error } = require('../errors');
|
||||
* @extends {Base}
|
||||
*/
|
||||
class GuildMember extends Base {
|
||||
/**
|
||||
* @param {Client} client The instantiating client
|
||||
* @param {Object} data The data for the guild member
|
||||
* @param {Guild} guild The guild the member is part of
|
||||
*/
|
||||
constructor(client, data, guild) {
|
||||
super(client);
|
||||
|
||||
|
||||
@@ -19,6 +19,11 @@ const APIMessage = require('./APIMessage');
|
||||
* @extends {Base}
|
||||
*/
|
||||
class Message extends Base {
|
||||
/**
|
||||
* @param {Client} client The instantiating client
|
||||
* @param {Object} data The data for the message
|
||||
* @param {TextChannel|DMChannel} channel The channel the message was sent in
|
||||
*/
|
||||
constructor(client, data, channel) {
|
||||
super(client);
|
||||
|
||||
|
||||
@@ -9,6 +9,11 @@ const ReactionUserStore = require('../stores/ReactionUserStore');
|
||||
* Represents a reaction to a message.
|
||||
*/
|
||||
class MessageReaction {
|
||||
/**
|
||||
* @param {Client} client The instantiating client
|
||||
* @param {Object} data The data for the message reaction
|
||||
* @param {Message} message The message the reaction refers to
|
||||
*/
|
||||
constructor(client, data, message) {
|
||||
/**
|
||||
* The message that this reaction refers to
|
||||
|
||||
@@ -25,6 +25,10 @@ const { ActivityTypes } = require('../util/Constants');
|
||||
* Represents a user's presence.
|
||||
*/
|
||||
class Presence {
|
||||
/**
|
||||
* @param {Client} client The instantiating client
|
||||
* @param {Object} [data={}] The data for the presence
|
||||
*/
|
||||
constructor(client, data = {}) {
|
||||
Object.defineProperty(this, 'client', { value: client });
|
||||
/**
|
||||
|
||||
@@ -11,6 +11,11 @@ const { Error, TypeError } = require('../errors');
|
||||
* @extends {Base}
|
||||
*/
|
||||
class Role extends Base {
|
||||
/**
|
||||
* @param {Client} client The instantiating client
|
||||
* @param {Object} data The data for the role
|
||||
* @param {Guild} guild The guild the role is part of
|
||||
*/
|
||||
constructor(client, data, guild) {
|
||||
super(client);
|
||||
|
||||
|
||||
@@ -13,6 +13,10 @@ const MessageStore = require('../stores/MessageStore');
|
||||
* @implements {TextBasedChannel}
|
||||
*/
|
||||
class TextChannel extends GuildChannel {
|
||||
/**
|
||||
* @param {Guild} guild The guild the text channel is part of
|
||||
* @param {Object} data The data for the text channel
|
||||
*/
|
||||
constructor(guild, data) {
|
||||
super(guild, data);
|
||||
/**
|
||||
|
||||
@@ -12,6 +12,10 @@ const { Error } = require('../errors');
|
||||
* @extends {Base}
|
||||
*/
|
||||
class User extends Base {
|
||||
/**
|
||||
* @param {Client} client The instantiating client
|
||||
* @param {Object} data The data for the user
|
||||
*/
|
||||
constructor(client, data) {
|
||||
super(client);
|
||||
|
||||
|
||||
@@ -6,6 +6,10 @@ const Base = require('./Base');
|
||||
* Represents the voice state for a Guild Member.
|
||||
*/
|
||||
class VoiceState extends Base {
|
||||
/**
|
||||
* @param {Guild} guild The guild the voice state is part of
|
||||
* @param {Object} data The data for the voice state
|
||||
*/
|
||||
constructor(guild, data) {
|
||||
super(guild.client);
|
||||
/**
|
||||
|
||||
2
typings/index.d.ts
vendored
2
typings/index.d.ts
vendored
@@ -809,7 +809,7 @@ declare module 'discord.js' {
|
||||
}
|
||||
|
||||
export class Presence {
|
||||
constructor(client: Client, data?: object);
|
||||
constructor(client: Client, data: object);
|
||||
public activity: Activity;
|
||||
public flags: Readonly<ActivityFlags>;
|
||||
public status: PresenceStatus;
|
||||
|
||||
Reference in New Issue
Block a user