Add jsdoc comments
This commit is contained in:
parent
78ae0bbb56
commit
8ad1a2ac6f
3 changed files with 33 additions and 0 deletions
|
@ -61,6 +61,10 @@ export class GuildManager extends BaseManager<GuildPayload, Guild> {
|
|||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a guild. Returns Guild. Fires guildCreate event.
|
||||
* @param options Options for creating a guild
|
||||
*/
|
||||
async create(options: GuildCreateOptions): Promise<Guild> {
|
||||
if (options.icon !== undefined && !options.icon.startsWith('data:')) {
|
||||
options.icon = await fetchAuto(options.icon)
|
||||
|
@ -115,6 +119,10 @@ export class GuildManager extends BaseManager<GuildPayload, Guild> {
|
|||
return guild
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets a preview of a guild. Returns GuildPreview.
|
||||
* @param guildID Guild id
|
||||
*/
|
||||
async preview(guildID: string): Promise<GuildPreview> {
|
||||
const resp: GuildPreviewPayload = await this.client.rest.get(
|
||||
GUILD_PREVIEW(guildID)
|
||||
|
@ -136,6 +144,12 @@ export class GuildManager extends BaseManager<GuildPayload, Guild> {
|
|||
return result
|
||||
}
|
||||
|
||||
/**
|
||||
* Edits a guild.
|
||||
* @param guild Guild or guild id
|
||||
* @param options Guild edit options
|
||||
* @param asRaw true for get raw data, false for get guild(defaults to false)
|
||||
*/
|
||||
async edit(
|
||||
guild: Guild | string,
|
||||
options: GuildModifyOptions,
|
||||
|
@ -210,6 +224,10 @@ export class GuildManager extends BaseManager<GuildPayload, Guild> {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Deletes a guild.
|
||||
* @param guild Guild or guild id
|
||||
*/
|
||||
async delete(guild: Guild | string): Promise<Guild | undefined> {
|
||||
if (guild instanceof Guild) {
|
||||
guild = guild.id
|
||||
|
|
|
@ -332,10 +332,15 @@ export class Guild extends Base {
|
|||
})
|
||||
}
|
||||
|
||||
/** Gets a preview of the guild. Returns GuildPreview. */
|
||||
async preview(): Promise<GuildPreview> {
|
||||
return this.client.guilds.preview(this.id)
|
||||
}
|
||||
|
||||
/**
|
||||
* Edits the guild.
|
||||
* @param options Guild edit options
|
||||
*/
|
||||
async edit(options: GuildModifyOptions): Promise<Guild> {
|
||||
const result = await this.client.guilds.edit(this.id, options, true)
|
||||
this.readFromData(result)
|
||||
|
@ -343,6 +348,7 @@ export class Guild extends Base {
|
|||
return new Guild(this.client, result)
|
||||
}
|
||||
|
||||
/** Deletes the guild. */
|
||||
async delete(): Promise<Guild> {
|
||||
const result = await this.client.guilds.delete(this.id)
|
||||
|
||||
|
|
|
@ -151,10 +151,19 @@ export class Message extends Base {
|
|||
return this.client.rest.delete(CHANNEL_MESSAGE(this.channelID, this.id))
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a reaction to the message.
|
||||
* @param emoji Emoji in string or object
|
||||
*/
|
||||
async addReaction(emoji: string | Emoji): Promise<void> {
|
||||
return this.channel.addReaction(this, emoji)
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes a reaction to the message.
|
||||
* @param emoji Emoji in string or object
|
||||
* @param user User or Member or user id
|
||||
*/
|
||||
async removeReaction(
|
||||
emoji: string | Emoji,
|
||||
user?: User | Member | string
|
||||
|
|
Loading…
Reference in a new issue