diff --git a/src/managers/guilds.ts b/src/managers/guilds.ts index 84e82b1..30a8747 100644 --- a/src/managers/guilds.ts +++ b/src/managers/guilds.ts @@ -61,6 +61,10 @@ export class GuildManager extends BaseManager { }) } + /** + * Creates a guild. Returns Guild. Fires guildCreate event. + * @param options Options for creating a guild + */ async create(options: GuildCreateOptions): Promise { if (options.icon !== undefined && !options.icon.startsWith('data:')) { options.icon = await fetchAuto(options.icon) @@ -115,6 +119,10 @@ export class GuildManager extends BaseManager { return guild } + /** + * Gets a preview of a guild. Returns GuildPreview. + * @param guildID Guild id + */ async preview(guildID: string): Promise { const resp: GuildPreviewPayload = await this.client.rest.get( GUILD_PREVIEW(guildID) @@ -136,6 +144,12 @@ export class GuildManager extends BaseManager { 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 { } } + /** + * Deletes a guild. + * @param guild Guild or guild id + */ async delete(guild: Guild | string): Promise { if (guild instanceof Guild) { guild = guild.id diff --git a/src/structures/guild.ts b/src/structures/guild.ts index 7ab0102..ec02a44 100644 --- a/src/structures/guild.ts +++ b/src/structures/guild.ts @@ -332,10 +332,15 @@ export class Guild extends Base { }) } + /** Gets a preview of the guild. Returns GuildPreview. */ async preview(): Promise { return this.client.guilds.preview(this.id) } + /** + * Edits the guild. + * @param options Guild edit options + */ async edit(options: GuildModifyOptions): Promise { 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 { const result = await this.client.guilds.delete(this.id) diff --git a/src/structures/message.ts b/src/structures/message.ts index 920994a..5cdbf75 100644 --- a/src/structures/message.ts +++ b/src/structures/message.ts @@ -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 { 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