disaccord v1.2.4
disaccordJS
Installation
npm install disaccord
Initalizing Your Bot
const client = require('disaccord');
client.connect('YOUR.TOKEN.HERE');
Listening For Events
client.on('EVENT_NAME', (event_data) => {
// Handle Event Here
});
You can find a list of events here, under Gateway Events
. Events are in all caps with _
used in place of spaces. You can also listen for EVENT
to handle any data from any event.
Channel Functions
All functions can be found under client.functions
and return a promise upon completion. You can read more on promises here.
getChannel(channelId)
Get a channel by ID. Returns a channel object.
deleteChannel(channelId)
Delete a channel, or close a private message. Requires the MANAGE_CHANNELS
permission for the guild. Deleting a category does not delete its child channels; they will have their parent_id removed and a Channel Update event will fire for each of them. Returns a channel object. on success. Fires a Channel Delete event.
getChannelMessages(channelId)
Returns the messages for a channel. If operating on a guild channel, this endpoint requires the VIEW_CHANNEL
permission to be present on the current user. Returns an array of message objects on success.
getChannelMessage(channelId, messageId)
Post a message to a guild text or DM channel. If operating on a guild channel, this endpoint requires the SEND_MESSAGES
permission to be present on the current user. If the tts field is set to true, the SEND_TTS_MESSAGES
permission is required for the message to be spoken. Returns a message object. Fires a Message Create event.
createMessage(channelId, message)
Post a message to a guild text or DM channel. If operating on a guild channel, this endpoint requires the SEND_MESSAGES
permission to be present on the current user. If the tts
field is set to true
, the SEND_TTS_MESSAGES
permission is required for the message to be spoken. Returns a message object. Fires a Message Create event.
createReaction(channelId, messageId, emoji)
Create a reaction for the message. emoji
takes the form of name:id
for custom guild emoji, or Unicode characters. This endpoint requires the READ_MESSAGE_HISTORY
permission to be present on the current user. Additionally, if nobody else has reacted to the message using this emoji, this endpoint requires the ADD_REACTIONS
permission to be present on the current user.
deleteOwnReaction(channelId, messageId, emoji)
Delete a reaction the current user has made for the message.
deleteUserReaction(channelId, messageId, emoji, userId)
Deletes another user's reaction. This endpoint requires the MANAGE_MESSAGES
permission to be present on the current user.
getReactions(channelId, messageId, emoji)
Get a list of users that reacted with this emoji. Returns an array of user objects on success.
deleteAllReactions(channelId, messageId)
Deletes all reactions on a message. This endpoint requires the MANAGE_MESSAGES
permission to be present on the current user.
editMessage(channelId, messageId, message)
Edit a previously sent message. You can only edit messages that have been sent by the current user. Returns a message object. Fires a Message Update event.
deleteMessage(channelId, messageId)
Delete a message. If operating on a guild channel and trying to delete a message that was not sent by the current user, this endpoint requires the MANAGE_MESSAGES
permission. Fires a Message Delete event.
bulkDeleteMessages(channelId, messageIds)
Delete multiple messages in a single request. This endpoint can only be used on guild channels and requires the MANAGE_MESSAGES
permission. Fires multiple Message Delete events.
triggerTypingIndicator(channelId)
Post a typing indicator for the specified channel. Generally bots should not implement this route. However, if a bot is responding to a command and expects the computation to take a few seconds, this endpoint may be called to let the user know that the bot is processing their message. Fires a Typing Start event.
getPinnedMessages(channelId)
Returns all pinned messages in the channel as an array of message objects.
addPinnedChannelMessage(channelId, messageId)
Pin a message in a channel. Requires the MANAGE_MESSAGES
permission.
deletePinnedChannelMessage(channelId, messageId)
Delete a pinned message in a channel. Requires the MANAGE_MESSAGES
permission.
Emoji Functions
All of the following functions are for managing guild emojis. You can read more on guild emojis here
listGuildEmojis(guildId)
Returns a list of emoji objects for the given guild.
getGuildEmoji(guildId, emojiId)
Returns an emoji object for the given guild and emoji IDs
createGuildEmoji(guildId, base64Image, name, roles)
Create a new emoji for the guild. Requires the MANAGE_EMOJIS
permission. Returns the new emoji object on success. Fires a Guild Emojis Update event. Emojis and animated emojis have a maximum file size of 256kb. Attempting to upload an emoji larger than this limit will fail. By default the emoji name is a random number and the roles are open to everyone.
modifyGuildEmoji(guildId, emojiId, name, roles)
Modify the given emoji. Requires the MANAGE_EMOJIS
permission. Returns the updated emoji object on success. Fires a Guild Emojis Update event. By default the emoji name is a random number and the roles are open to everyone.
deleteGuildEmoji(guildId, emojiId)
Delete the given emoji. Requires the MANAGE_EMOJIS
permission. Fires a Guild Emojis Update event.