Options
All
  • Public
  • Public/Protected
  • All
Menu

Class BotAPI

Creates all outgoing API requests

Hierarchy

  • BotAPI

Index

Constructors

constructor

  • new BotAPI(bot: Bot, token: string): BotAPI

Methods

addMessageReaction

  • Creates a reaction for a message. This method requires the Permission.ReadMessageHistory permission to be present on the Bot. Additionally, if nobody else has reacted to the message using this emoji, this method requires the Permission.AddReactions permission to be present on the Bot.

    Parameters

    • channelId: Snowflake

      The ID of the channel containing the message

    • messageId: Snowflake

      The ID of the message to react to

    • emoji: EmojiResolvable

      The emoji to react with to the message

    Returns Promise<void>

banMember

bulkDeleteMessages

createChannelInvite

createDM

createGuildChannel

createGuildEmoji

createGuildIntegration

createRole

createWebhook

deleteChannel

deleteGuildChannel

deleteGuildChannelPermission

  • deleteGuildChannelPermission(channelId: Snowflake, permissible: Snowflake): Promise<void>
  • Deletes a channel permission overwrite for a user or role in a guild channel. Requires the Permission.ManageRoles permission

    Parameters

    • channelId: Snowflake

      The ID of the channel that contains the permission overwrite you wish to delete

    • permissible: Snowflake

      The ID of the user or role you wish to delete from the channel's permission overwrites

    Returns Promise<void>

deleteGuildEmoji

deleteGuildIntegration

deleteInvite

  • deleteInvite(inviteCode: string): Promise<Invite>

deleteMessage

  • Deletes a message. If operating on a GuildChannel and trying to delete a message that was not sent by the current user, this endpoint requires the Permission.ManageMessages permission

    Parameters

    • channelId: Snowflake

      The ID of the channel that contains the message you wish to delete

    • messageId: Snowflake

      The ID of the message you wish to delete

    Returns Promise<void>

deleteRole

deleteWebhook

  • deleteWebhook(webhookId: Snowflake): Promise<void>

editMessage

  • Edits a previously sent message. The fields content, embed and flags can be edited by the original message author. Other users can only edit flags and only if they have the Permission.ManageMessages permission in the corresponding channel.

    example
    message.edit('Updated content!');
    1. A MessageEditData object, containing any of the fields @example ```typescript message.edit({ content: 'Updated content!', embed: { title: 'My Embed!' } }); ```

    Parameters

    • channelId: Snowflake

      The ID of the channel that contains the message you wish to edit

    • messageId: Snowflake

      The ID of the message you wish to edit

    • data: string | MessageEditData

      The updated message data. Can be:

      1. Raw content to be edited to

    Returns Promise<Message>

fetchBotGuilds

fetchBotUser

fetchChannel

fetchChannelInvites

fetchChannelPins

fetchDMChannel

fetchGuild

fetchGuildBan

fetchGuildBans

fetchGuildChannel

fetchGuildChannels

fetchGuildEmoji

fetchGuildEmojis

fetchGuildIntegrations

fetchGuildInvites

fetchGuildPreview

fetchGuildVanityURL

fetchGuildWebhooks

fetchGuildWidget

fetchInvite

fetchMember

fetchMessage

  • Fetches a message in a text channel by their IDs

    Parameters

    • channelId: Snowflake

      The ID of the channel that contains the message

    • messageId: Snowflake

      The ID of the message you wish to fetch

    Returns Promise<Message>

fetchReactionUsers

fetchRoles

fetchSomeMembers

fetchSomeMessages

fetchUser

fetchWebhook

fetchWebhooks

guildPrune

guildPruneCount

  • Returns the number of members that would be removed in a prune operation. Any inactive user that has a subset of the provided role(s) will be counted in the prune and users with additional roles will not.

    Parameters

    Returns Promise<number>

leaveGuild

  • leaveGuild(guildId: Snowflake): Promise<void>

memberAddRole

memberRemoveRole

modifyBotNickname

  • modifyBotNickname(guildId: Snowflake, nick?: undefined | string): Promise<string>
  • Modifies the nickname of the bot user in a guild. Returns the modified nickname

    Parameters

    • guildId: Snowflake

      The ID of the guild

    • Optional nick: undefined | string

      The new nickname for the bot

    Returns Promise<string>

modifyBotUser

modifyGuild

modifyGuildChannel

modifyGuildChannelPermissions

modifyGuildChannelsPositions

modifyGuildEmoji

modifyGuildIntegration

modifyGuildWidget

modifyMember

modifyMemberNickname

  • modifyMemberNickname(guildId: Snowflake, userId: Snowflake, nick?: undefined | string): Promise<string | void>
  • Modify a guild member's nickname. Returns the modified nickname when changing this bot's nickname or void when changing another member's nickname

    Parameters

    • guildId: Snowflake

      The ID of the guild

    • userId: Snowflake

      The ID of the member user

    • Optional nick: undefined | string

      The new nickname

    Returns Promise<string | void>

modifyRole

modifyRolesPositions

modifyWebhook

pinMessage

removeMember

removeMessageReaction

  • Deletes a reaction a user reacted with. If no userId argument was provided, the Bot will remove its own reaction.

    Parameters

    • channelId: Snowflake

      The ID of the channel containing the message

    • messageId: Snowflake

      The ID of the message to react to

    • emoji: EmojiResolvable

      The emoji to delete from the message

    • Default value userId: Snowflake = "@me"

      The ID of the user of which reaction should be removed

    Returns Promise<void>

removeMessageReactions

  • Removes all reactions on a message. This method requires the Permission.ManageMessages permission to be present on the Bot

    Parameters

    • channelId: Snowflake

      The ID of the channel containing the message

    • messageId: Snowflake

      The ID of the message of which to remove all reactions

    Returns Promise<void>

removeMessageReactionsEmoji

  • Deletes all reactions for an emoji. This method requires the Permission.ManageMessages permission ot be present on the Bot.

    Parameters

    • channelId: Snowflake

      The ID of the channel containing the message

    • messageId: Snowflake

      The ID of the message of which to remove all reactions for a given emoji

    • emoji: EmojiResolvable

      The reaction emoji you wish to delete

    Returns Promise<void>

sendMessage

syncGuildIntegration

triggerTextChannelTyping

  • triggerTextChannelTyping(channelId: Snowflake): Promise<void>
  • Posts a typing indicator for a specified text channel. Useful when the bot is responding to a command and expects the computation to take a few seconds. This method may be called to let the user know that the bot is processing their message.

    Parameters

    • channelId: Snowflake

      The ID of the text channel to trigger typing in

    Returns Promise<void>

unbanMember

unpinMessage

Generated using TypeDoc