Hi there! Are you looking for the official Deno documentation? Try docs.deno.com for all your Deno learning needs.

RestClient

import { RestClient } from "https://raw.githubusercontent.com/denosaurs/denord/26ae2cc4c0f8c03b14d2b36eaa74b9e6d49665ed/mod.ts";

a client to make HTTP requests to Discord NOTE: there are no explanations what each of the methods do as they are identical to Discord's endpoints

class RestClient {
constructor(token?: string);
token: string;
 
private async request(
endpoint: string,
method: (
| "GET"
| "POST"
| "PUT"
| "PATCH"
| "DELETE"
)
,
data?: any,
): Promise<unknown>;
async addGuildMember(
guildId: Discord.Snowflake,
userId: Discord.Snowflake,
data: Discord.guildMember.Add,
);
async addGuildMemberRole(
guildId: Discord.Snowflake,
userId: Discord.Snowflake,
roleId: Discord.Snowflake,
);
async addPinnedChannelMessage(channelId: Discord.Snowflake, messageId: Discord.Snowflake);
async beginGuildPrune(guildId: Discord.Snowflake, params: Discord.guild.BeginPruneParams);
async bulkDeleteMessages(channelId: Discord.Snowflake, data: Discord.channel.BulkDelete);
async createChannelInvite(channelId: Discord.Snowflake, data: Discord.invite.Create);
async createDM(data: Discord.channel.CreateDM);
async createGroupDM(data: Discord.channel.CreateGroupDM);
async createGuild(data: Discord.guild.Create);
async createGuildBan(
guildId: Discord.Snowflake,
userId: Discord.Snowflake,
params: Discord.guild.CreateBan,
);
async createGuildChannel(guildId: Discord.Snowflake, data: Discord.channel.CreateGuildChannel);
async createGuildEmoji(guildId: Discord.Snowflake, data: Discord.emoji.Create);
async createGuildIntegration(guildId: Discord.Snowflake, data: Discord.integration.Create);
async createGuildRole(guildId: Discord.Snowflake, data: Discord.role.Create);
async createMessage(channelId: Discord.Snowflake, data: Discord.message.Create);
async createReaction(
channelId: Discord.Snowflake,
messageId: Discord.Snowflake,
emoji: string,
);
async createWebhook(channelId: Discord.Snowflake, data: Discord.webhook.Create);
async deleteAllReactions(channelId: Discord.Snowflake, messageId: Discord.Snowflake);
async deleteAllReactionsForEmoji(
channelId: Discord.Snowflake,
messageId: Discord.Snowflake,
emoji: string,
);
async deleteChannel(channelId: Discord.Snowflake);
async deleteChannelPermission(channelId: Discord.Snowflake, overwriteId: Discord.Snowflake);
async deleteGuild(guildId: Discord.Snowflake);
async deleteGuildEmoji(guildId: Discord.Snowflake, emojiId: Discord.Snowflake);
async deleteGuildIntegration(guildId: Discord.Snowflake, integrationId: Discord.Snowflake);
async deleteGuildRole(guildId: Discord.Snowflake, roleId: Discord.Snowflake);
async deleteInvite(inviteCode: string);
async deleteMessage(channelId: Discord.Snowflake, messageId: Discord.Snowflake);
async deleteOwnReaction(
channelId: Discord.Snowflake,
messageId: Discord.Snowflake,
emoji: string,
);
async deletePinnedChannelMessage(channelId: Discord.Snowflake, messageId: Discord.Snowflake);
async deleteUserReaction(
channelId: Discord.Snowflake,
messageId: Discord.Snowflake,
emoji: string,
userId: Discord.Snowflake,
);
async deleteWebhook(webhookId: Discord.Snowflake);
async deleteWebhookWithToken(webhookId: Discord.Snowflake, webhookToken: string);
async editChannelPermissions(
channelId: Discord.Snowflake,
overwriteId: Discord.Snowflake,
data: Omit<Discord.channel.Overwrite, "id">,
);
async editMessage(
channelId: Discord.Snowflake,
messageId: Discord.Snowflake,
data: Discord.message.Edit,
);
async executeGitHubCompatibleWebhook(
webhookId: Discord.Snowflake,
webhookToken: string,
data: any,
params: Discord.webhook.ExecuteParams,
);
async executeSlackCompatibleWebhook(
webhookId: Discord.Snowflake,
webhookToken: string,
data: any,
params: Discord.webhook.ExecuteParams,
);
async executeWebhook(
webhookId: Discord.Snowflake,
webhookToken: string,
data: Discord.webhook.ExecuteBody,
params: Discord.webhook.ExecuteParams,
);
async getChannel(channelId: Discord.Snowflake);
async getChannelInvites(channelId: Discord.Snowflake);
async getChannelMessage(channelId: Discord.Snowflake, messageId: Discord.Snowflake);
async getChannelMessages(channelId: Discord.Snowflake, params: Discord.channel.GetMessages);
async getChannelWebhooks(channelId: Discord.Snowflake);
async getCurrentUser();
async getCurrentUserGuilds(params: Discord.user.GetGuilds);
async getGateway();
async getGatewayBot();
async getGuild(guildId: Discord.Snowflake);
async getGuildAuditLog(guildId: Discord.Snowflake);
async getGuildBan(guildId: Discord.Snowflake, userId: Discord.Snowflake);
async getGuildBans(guildId: Discord.Snowflake);
async getGuildChannels(guildId: Discord.Snowflake);
async getGuildEmbed(guildId: Discord.Snowflake);
async getGuildEmbedImage(guildId: Discord.Snowflake, params: Discord.guild.WidgetEmbedStyle);
async getGuildEmoji(guildId: Discord.Snowflake, emojiId: Discord.Snowflake);
async getGuildIntegrations(guildId: Discord.Snowflake);
async getGuildInvites(guildId: Discord.Snowflake);
async getGuildMember(guildId: Discord.Snowflake, userId: Discord.Snowflake);
async getGuildPruneCount(guildId: Discord.Snowflake, params: Discord.guild.PruneCount);
async getGuildRoles(guildId: Discord.Snowflake);
async getGuildVanityURL(guildId: Discord.Snowflake);
async getGuildVoiceRegions(guildId: Discord.Snowflake);
async getGuildWebhooks(guildId: Discord.Snowflake);
async getGuildWidgetImage(guildId: Discord.Snowflake, params: Discord.guild.WidgetEmbedStyle);
async getInvite(inviteCode: string);
async getPinnedMessages(channelId: Discord.Snowflake);
async getReactions(
channelId: Discord.Snowflake,
messageId: Discord.Snowflake,
emoji: string,
params: Discord.channel.GetReactions,
);
async getUser(userId: Discord.Snowflake);
async getUserConnections();
async getUserDMs();
async getWebhook(webhookId: Discord.Snowflake);
async getWebhookWithToken(webhookId: Discord.Snowflake, webhookToken: string);
async groupDMAddRecipient(
channelId: Discord.Snowflake,
userId: Discord.Snowflake,
data: Discord.channel.GroupDMAddRecipient,
);
async groupDMRemoveRecipient(channelId: Discord.Snowflake, userId: Discord.Snowflake);
async leaveGuild(guildId: Discord.Snowflake);
async listGuildEmojis(guildId: Discord.Snowflake);
async listGuildMembers(guildId: Discord.Snowflake, params: Discord.guildMember.List);
async listVoiceRegions();
async modifyChannel(channelId: Discord.Snowflake, data: Discord.channel.Modify);
async modifyCurrentUser(data: Discord.user.Modify);
async modifyCurrentUserNick(
guildId: Discord.Snowflake,
userId: Discord.Snowflake,
data: Discord.guildMember.ModifyCurrentNick,
);
async modifyGuild(guildId: Discord.Snowflake, data: Discord.guild.Modify);
async modifyGuildChannelPositions(guildId: Discord.Snowflake, data: Discord.channel.GuildPosition);
async modifyGuildEmbed(guildId: Discord.Snowflake, data: Discord.guild.EmbedModify);
async modifyGuildEmoji(
guildId: Discord.Snowflake,
emojiId: Discord.Snowflake,
data: Discord.emoji.Modify,
);
async modifyGuildIntegration(
guildId: Discord.Snowflake,
integrationId: Discord.Snowflake,
data: Discord.integration.Modify,
);
async modifyGuildMember(
guildId: Discord.Snowflake,
userId: Discord.Snowflake,
data: Discord.guildMember.Modify,
);
async modifyGuildRole(guildId: Discord.Snowflake, data: Discord.role.Modify);
async modifyGuildRolePositions(guildId: Discord.Snowflake, data: Discord.role.ModifyPosition);
async modifyWebhook(webhookId: Discord.Snowflake, data: Discord.webhook.Modify);
async modifyWebhookWithToken(
webhookId: Discord.Snowflake,
webhookToken: string,
data: Discord.webhook.Modify,
);
async removeGuildBan(guildId: Discord.Snowflake, userId: Discord.Snowflake);
async removeGuildMember(guildId: Discord.Snowflake, userId: Discord.Snowflake);
async removeGuildMemberRole(
guildId: Discord.Snowflake,
userId: Discord.Snowflake,
roleId: Discord.Snowflake,
);
async syncGuildIntegration(guildId: Discord.Snowflake, integrationId: Discord.Snowflake);
async triggerTypingIndicator(channelId: Discord.Snowflake);
}

§Constructors

§
new RestClient(token?: string)
[src]

§Properties

§
token: string
[src]

the token to make requests with

§Methods

§
request(endpoint: string, method: (
| "GET"
| "POST"
| "PUT"
| "PATCH"
| "DELETE"
)
, data?: any): Promise<unknown> private
[src]
§
addGuildMember(guildId: Discord.Snowflake, userId: Discord.Snowflake, data: Discord.guildMember.Add)
[src]
§
addGuildMemberRole(guildId: Discord.Snowflake, userId: Discord.Snowflake, roleId: Discord.Snowflake)
[src]
§
addPinnedChannelMessage(channelId: Discord.Snowflake, messageId: Discord.Snowflake)
[src]
§
beginGuildPrune(guildId: Discord.Snowflake, params: Discord.guild.BeginPruneParams)
[src]
§
bulkDeleteMessages(channelId: Discord.Snowflake, data: Discord.channel.BulkDelete)
[src]
§
createChannelInvite(channelId: Discord.Snowflake, data: Discord.invite.Create)
[src]
§
createDM(data: Discord.channel.CreateDM)
[src]
§
createGroupDM(data: Discord.channel.CreateGroupDM)
[src]
§
createGuild(data: Discord.guild.Create)
[src]
§
createGuildBan(guildId: Discord.Snowflake, userId: Discord.Snowflake, params: Discord.guild.CreateBan)
[src]
§
createGuildChannel(guildId: Discord.Snowflake, data: Discord.channel.CreateGuildChannel)
[src]
§
createGuildEmoji(guildId: Discord.Snowflake, data: Discord.emoji.Create)
[src]
§
createGuildIntegration(guildId: Discord.Snowflake, data: Discord.integration.Create)
[src]
§
createGuildRole(guildId: Discord.Snowflake, data: Discord.role.Create)
[src]
§
createMessage(channelId: Discord.Snowflake, data: Discord.message.Create)
[src]
§
createReaction(channelId: Discord.Snowflake, messageId: Discord.Snowflake, emoji: string)
[src]
§
createWebhook(channelId: Discord.Snowflake, data: Discord.webhook.Create)
[src]
§
deleteAllReactions(channelId: Discord.Snowflake, messageId: Discord.Snowflake)
[src]
§
deleteAllReactionsForEmoji(channelId: Discord.Snowflake, messageId: Discord.Snowflake, emoji: string)
[src]
§
deleteChannel(channelId: Discord.Snowflake)
[src]
§
deleteChannelPermission(channelId: Discord.Snowflake, overwriteId: Discord.Snowflake)
[src]
§
deleteGuild(guildId: Discord.Snowflake)
[src]
§
deleteGuildEmoji(guildId: Discord.Snowflake, emojiId: Discord.Snowflake)
[src]
§
deleteGuildIntegration(guildId: Discord.Snowflake, integrationId: Discord.Snowflake)
[src]
§
deleteGuildRole(guildId: Discord.Snowflake, roleId: Discord.Snowflake)
[src]
§
deleteInvite(inviteCode: string)
[src]
§
deleteMessage(channelId: Discord.Snowflake, messageId: Discord.Snowflake)
[src]
§
deleteOwnReaction(channelId: Discord.Snowflake, messageId: Discord.Snowflake, emoji: string)
[src]
§
deletePinnedChannelMessage(channelId: Discord.Snowflake, messageId: Discord.Snowflake)
[src]
§
deleteUserReaction(channelId: Discord.Snowflake, messageId: Discord.Snowflake, emoji: string, userId: Discord.Snowflake)
[src]
§
deleteWebhook(webhookId: Discord.Snowflake)
[src]
§
deleteWebhookWithToken(webhookId: Discord.Snowflake, webhookToken: string)
[src]
§
editChannelPermissions(channelId: Discord.Snowflake, overwriteId: Discord.Snowflake, data: Omit<Discord.channel.Overwrite, "id">)
[src]
§
editMessage(channelId: Discord.Snowflake, messageId: Discord.Snowflake, data: Discord.message.Edit)
[src]
§
executeGitHubCompatibleWebhook(webhookId: Discord.Snowflake, webhookToken: string, data: any, params: Discord.webhook.ExecuteParams)
[src]
§
executeSlackCompatibleWebhook(webhookId: Discord.Snowflake, webhookToken: string, data: any, params: Discord.webhook.ExecuteParams)
[src]
§
executeWebhook(webhookId: Discord.Snowflake, webhookToken: string, data: Discord.webhook.ExecuteBody, params: Discord.webhook.ExecuteParams)
[src]
§
getChannel(channelId: Discord.Snowflake)
[src]
§
getChannelInvites(channelId: Discord.Snowflake)
[src]
§
getChannelMessage(channelId: Discord.Snowflake, messageId: Discord.Snowflake)
[src]
§
getChannelMessages(channelId: Discord.Snowflake, params: Discord.channel.GetMessages)
[src]
§
getChannelWebhooks(channelId: Discord.Snowflake)
[src]
§
getCurrentUser()
[src]
§
getCurrentUserGuilds(params: Discord.user.GetGuilds)
[src]
§
getGateway()
[src]
§
getGatewayBot()
[src]
§
getGuild(guildId: Discord.Snowflake)
[src]
§
getGuildAuditLog(guildId: Discord.Snowflake)
[src]
§
getGuildBan(guildId: Discord.Snowflake, userId: Discord.Snowflake)
[src]
§
getGuildBans(guildId: Discord.Snowflake)
[src]
§
getGuildChannels(guildId: Discord.Snowflake)
[src]
§
getGuildEmbed(guildId: Discord.Snowflake)
[src]
§
getGuildEmbedImage(guildId: Discord.Snowflake, params: Discord.guild.WidgetEmbedStyle)
[src]
§
getGuildEmoji(guildId: Discord.Snowflake, emojiId: Discord.Snowflake)
[src]
§
getGuildIntegrations(guildId: Discord.Snowflake)
[src]
§
getGuildInvites(guildId: Discord.Snowflake)
[src]
§
getGuildMember(guildId: Discord.Snowflake, userId: Discord.Snowflake)
[src]
§
getGuildPruneCount(guildId: Discord.Snowflake, params: Discord.guild.PruneCount)
[src]
§
getGuildRoles(guildId: Discord.Snowflake)
[src]
§
getGuildVanityURL(guildId: Discord.Snowflake)
[src]
§
getGuildVoiceRegions(guildId: Discord.Snowflake)
[src]
§
getGuildWebhooks(guildId: Discord.Snowflake)
[src]
§
getGuildWidgetImage(guildId: Discord.Snowflake, params: Discord.guild.WidgetEmbedStyle)
[src]
§
getInvite(inviteCode: string)
[src]
§
getPinnedMessages(channelId: Discord.Snowflake)
[src]
§
getReactions(channelId: Discord.Snowflake, messageId: Discord.Snowflake, emoji: string, params: Discord.channel.GetReactions)
[src]
§
getUser(userId: Discord.Snowflake)
[src]
§
getUserConnections()
[src]
§
getUserDMs()
[src]
§
getWebhook(webhookId: Discord.Snowflake)
[src]
§
getWebhookWithToken(webhookId: Discord.Snowflake, webhookToken: string)
[src]
§
groupDMAddRecipient(channelId: Discord.Snowflake, userId: Discord.Snowflake, data: Discord.channel.GroupDMAddRecipient)
[src]
§
groupDMRemoveRecipient(channelId: Discord.Snowflake, userId: Discord.Snowflake)
[src]
§
leaveGuild(guildId: Discord.Snowflake)
[src]
§
listGuildEmojis(guildId: Discord.Snowflake)
[src]
§
listGuildMembers(guildId: Discord.Snowflake, params: Discord.guildMember.List)
[src]
§
listVoiceRegions()
[src]
§
modifyChannel(channelId: Discord.Snowflake, data: Discord.channel.Modify)
[src]
§
modifyCurrentUser(data: Discord.user.Modify)
[src]
§
modifyCurrentUserNick(guildId: Discord.Snowflake, userId: Discord.Snowflake, data: Discord.guildMember.ModifyCurrentNick)
[src]
§
modifyGuild(guildId: Discord.Snowflake, data: Discord.guild.Modify)
[src]
§
modifyGuildChannelPositions(guildId: Discord.Snowflake, data: Discord.channel.GuildPosition)
[src]
§
modifyGuildEmbed(guildId: Discord.Snowflake, data: Discord.guild.EmbedModify)
[src]
§
modifyGuildEmoji(guildId: Discord.Snowflake, emojiId: Discord.Snowflake, data: Discord.emoji.Modify)
[src]
§
modifyGuildIntegration(guildId: Discord.Snowflake, integrationId: Discord.Snowflake, data: Discord.integration.Modify)
[src]
§
modifyGuildMember(guildId: Discord.Snowflake, userId: Discord.Snowflake, data: Discord.guildMember.Modify)
[src]
§
modifyGuildRole(guildId: Discord.Snowflake, data: Discord.role.Modify)
[src]
§
modifyGuildRolePositions(guildId: Discord.Snowflake, data: Discord.role.ModifyPosition)
[src]
§
modifyWebhook(webhookId: Discord.Snowflake, data: Discord.webhook.Modify)
[src]
§
modifyWebhookWithToken(webhookId: Discord.Snowflake, webhookToken: string, data: Discord.webhook.Modify)
[src]
§
removeGuildBan(guildId: Discord.Snowflake, userId: Discord.Snowflake)
[src]
§
removeGuildMember(guildId: Discord.Snowflake, userId: Discord.Snowflake)
[src]
§
removeGuildMemberRole(guildId: Discord.Snowflake, userId: Discord.Snowflake, roleId: Discord.Snowflake)
[src]
§
syncGuildIntegration(guildId: Discord.Snowflake, integrationId: Discord.Snowflake)
[src]
§
triggerTypingIndicator(channelId: Discord.Snowflake)
[src]