mirror of
https://github.com/discordeno/discordeno.git
synced 2026-06-16 19:28:17 +00:00
refactor(util): update endpoints (#383)
* Update constants.ts * fiiiixxxx * dupe * Update src/util/constants.ts Co-authored-by: Ayyan <ayyantee@gmail.com> * USER_DM * fix this and remove that * Update src/util/constants.ts Co-authored-by: Ayyan <ayyantee@gmail.com> * Update constants.ts * Update src/util/constants.ts Co-authored-by: Ayyan <ayyantee@gmail.com> * Update src/util/constants.ts Co-authored-by: Ayyan <ayyantee@gmail.com> * need these * hmm * rename GUILD_EMBED to GUILD_WIDGET * idk * Update src/util/constants.ts Co-authored-by: Ayyan <ayyantee@gmail.com> * Update constants.ts * Update constants.ts Co-authored-by: Ayyan <ayyantee@gmail.com>
This commit is contained in:
@@ -417,7 +417,7 @@ export async function editChannel(
|
|||||||
};
|
};
|
||||||
|
|
||||||
return RequestManager.patch(
|
return RequestManager.patch(
|
||||||
endpoints.GUILD_CHANNEL(channelID),
|
endpoints.CHANNEL_BASE(channelID),
|
||||||
{
|
{
|
||||||
...payload,
|
...payload,
|
||||||
reason,
|
reason,
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ export async function createServer(options: CreateServerOptions) {
|
|||||||
/** Delete a guild permanently. User must be owner. Returns 204 No Content on success. Fires a Guild Delete Gateway event.
|
/** Delete a guild permanently. User must be owner. Returns 204 No Content on success. Fires a Guild Delete Gateway event.
|
||||||
*/
|
*/
|
||||||
export function deleteServer(guildID: string) {
|
export function deleteServer(guildID: string) {
|
||||||
return RequestManager.delete(endpoints.GUILD(guildID));
|
return RequestManager.delete(endpoints.GUILDS_BASE(guildID));
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Gets an array of all the channels ids that are the children of this category. */
|
/** Gets an array of all the channels ids that are the children of this category. */
|
||||||
@@ -148,7 +148,7 @@ export async function deleteChannel(
|
|||||||
throw new Error(Errors.MISSING_MANAGE_CHANNELS);
|
throw new Error(Errors.MISSING_MANAGE_CHANNELS);
|
||||||
}
|
}
|
||||||
|
|
||||||
return RequestManager.delete(endpoints.CHANNEL(channelID), { reason });
|
return RequestManager.delete(endpoints.CHANNEL_BASE(channelID), { reason });
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Returns a list of guild channel objects.
|
/** Returns a list of guild channel objects.
|
||||||
@@ -174,7 +174,7 @@ export async function getChannels(guildID: string, addToCache = true) {
|
|||||||
*/
|
*/
|
||||||
export async function getChannel(channelID: string, addToCache = true) {
|
export async function getChannel(channelID: string, addToCache = true) {
|
||||||
const result = await RequestManager.get(
|
const result = await RequestManager.get(
|
||||||
endpoints.GUILD_CHANNEL(channelID),
|
endpoints.CHANNEL_BASE(channelID),
|
||||||
) as ChannelCreatePayload;
|
) as ChannelCreatePayload;
|
||||||
const channel = await structures.createChannel(result, result.guild_id);
|
const channel = await structures.createChannel(result, result.guild_id);
|
||||||
if (addToCache) await cacheHandlers.set("channels", channel.id, channel);
|
if (addToCache) await cacheHandlers.set("channels", channel.id, channel);
|
||||||
@@ -462,7 +462,7 @@ export async function getEmbed(guildID: string) {
|
|||||||
throw new Error(Errors.MISSING_MANAGE_GUILD);
|
throw new Error(Errors.MISSING_MANAGE_GUILD);
|
||||||
}
|
}
|
||||||
|
|
||||||
return RequestManager.get(endpoints.GUILD_EMBED(guildID));
|
return RequestManager.get(endpoints.GUILD_WIDGET(guildID));
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Modify a guild embed object for the guild. Requires the MANAGE_GUILD permission. */
|
/** Modify a guild embed object for the guild. Requires the MANAGE_GUILD permission. */
|
||||||
@@ -477,7 +477,7 @@ export async function editEmbed(
|
|||||||
}
|
}
|
||||||
|
|
||||||
return RequestManager.patch(
|
return RequestManager.patch(
|
||||||
endpoints.GUILD_EMBED(guildID),
|
endpoints.GUILD_WIDGET(guildID),
|
||||||
{ enabled, channel_id: channelID },
|
{ enabled, channel_id: channelID },
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -603,7 +603,7 @@ export async function editGuild(guildID: string, options: GuildEditOptions) {
|
|||||||
options.splash = await urlToBase64(options.splash);
|
options.splash = await urlToBase64(options.splash);
|
||||||
}
|
}
|
||||||
|
|
||||||
return RequestManager.patch(endpoints.GUILD(guildID), options);
|
return RequestManager.patch(endpoints.GUILDS_BASE(guildID), options);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Get all the invites for this guild. Requires MANAGE_GUILD permission */
|
/** Get all the invites for this guild. Requires MANAGE_GUILD permission */
|
||||||
@@ -653,7 +653,7 @@ export function getUser(userID: string) {
|
|||||||
* */
|
* */
|
||||||
export function getGuild(guildID: string, counts = true) {
|
export function getGuild(guildID: string, counts = true) {
|
||||||
return RequestManager.get(
|
return RequestManager.get(
|
||||||
endpoints.GUILD(guildID),
|
endpoints.GUILDS_BASE(guildID),
|
||||||
{ with_counts: counts },
|
{ with_counts: counts },
|
||||||
) as Promise<UpdateGuildPayload>;
|
) as Promise<UpdateGuildPayload>;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -124,7 +124,7 @@ export async function sendDirectMessage(
|
|||||||
if (!dmChannel) {
|
if (!dmChannel) {
|
||||||
// If not available in cache create a new one.
|
// If not available in cache create a new one.
|
||||||
const dmChannelData = await RequestManager.post(
|
const dmChannelData = await RequestManager.post(
|
||||||
endpoints.USER_CREATE_DM,
|
endpoints.USER_DM,
|
||||||
{ recipient_id: memberID },
|
{ recipient_id: memberID },
|
||||||
) as DMChannelCreatePayload;
|
) as DMChannelCreatePayload;
|
||||||
// Channel create event will have added this channel to the cache
|
// Channel create event will have added this channel to the cache
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
import { botID } from "../../bot.ts";
|
import { botID } from "../../bot.ts";
|
||||||
|
import { RequestManager } from "../../rest/request_manager.ts";
|
||||||
import {
|
import {
|
||||||
CreateSlashCommandOptions,
|
CreateSlashCommandOptions,
|
||||||
EditSlashCommandOptions,
|
EditSlashCommandOptions,
|
||||||
@@ -17,7 +18,6 @@ import { endpoints } from "../../util/constants.ts";
|
|||||||
import { botHasChannelPermissions } from "../../util/permissions.ts";
|
import { botHasChannelPermissions } from "../../util/permissions.ts";
|
||||||
import { urlToBase64 } from "../../util/utils.ts";
|
import { urlToBase64 } from "../../util/utils.ts";
|
||||||
import { structures } from "../structures/mod.ts";
|
import { structures } from "../structures/mod.ts";
|
||||||
import { RequestManager } from "../../rest/request_manager.ts";
|
|
||||||
|
|
||||||
/** Create a new webhook. Requires the MANAGE_WEBHOOKS permission. Returns a webhook object on success. Webhook names follow our naming restrictions that can be found in our Usernames and Nicknames documentation, with the following additional stipulations:
|
/** Create a new webhook. Requires the MANAGE_WEBHOOKS permission. Returns a webhook object on success. Webhook names follow our naming restrictions that can be found in our Usernames and Nicknames documentation, with the following additional stipulations:
|
||||||
*
|
*
|
||||||
@@ -166,7 +166,7 @@ export function editWebhookMessage(
|
|||||||
}
|
}
|
||||||
|
|
||||||
return RequestManager.patch(
|
return RequestManager.patch(
|
||||||
endpoints.WEBHOOK_EDIT(webhookID, webhookToken, messageID),
|
endpoints.WEBHOOK_MESSAGE(webhookID, webhookToken, messageID),
|
||||||
{ ...options, allowed_mentions: options.allowed_mentions },
|
{ ...options, allowed_mentions: options.allowed_mentions },
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -177,7 +177,7 @@ export function deleteWebhookMessage(
|
|||||||
messageID: string,
|
messageID: string,
|
||||||
) {
|
) {
|
||||||
return RequestManager.delete(
|
return RequestManager.delete(
|
||||||
endpoints.WEBHOOK_DELETE(webhookID, webhookToken, messageID),
|
endpoints.WEBHOOK_MESSAGE(webhookID, webhookToken, messageID),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+110
-87
@@ -20,127 +20,150 @@ export const baseEndpoints = {
|
|||||||
CDN_URL: IMAGE_BASE_URL,
|
CDN_URL: IMAGE_BASE_URL,
|
||||||
};
|
};
|
||||||
|
|
||||||
const GUILDS_BASE = (id: string) => `${baseEndpoints.BASE_URL}/guilds/${id}`;
|
const GUILDS_BASE = (guildID: string) =>
|
||||||
|
`${baseEndpoints.BASE_URL}/guilds/${guildID}`;
|
||||||
|
const CHANNEL_BASE = (channelID: string) =>
|
||||||
|
`${baseEndpoints.BASE_URL}/channels/${channelID}`;
|
||||||
|
|
||||||
export const endpoints = {
|
export const endpoints = {
|
||||||
|
GUILDS_BASE,
|
||||||
|
CHANNEL_BASE,
|
||||||
|
|
||||||
GATEWAY_BOT: `${baseEndpoints.BASE_URL}/gateway/bot`,
|
GATEWAY_BOT: `${baseEndpoints.BASE_URL}/gateway/bot`,
|
||||||
|
|
||||||
// Channel Endpoints
|
// Channel Endpoints
|
||||||
CHANNEL: (id: string) => `${baseEndpoints.BASE_URL}/channels/${id}`,
|
CHANNEL_MESSAGE: (channelID: string, messageID: string) =>
|
||||||
CHANNEL_MESSAGE: (id: string, messageID: string) =>
|
`${CHANNEL_BASE(channelID)}/messages/${messageID}`,
|
||||||
`${baseEndpoints.BASE_URL}/channels/${id}/messages/${messageID}`,
|
CHANNEL_MESSAGES: (channelID: string) =>
|
||||||
CHANNEL_MESSAGES: (id: string) =>
|
`${CHANNEL_BASE(channelID)}/messages`,
|
||||||
`${baseEndpoints.BASE_URL}/channels/${id}/messages`,
|
|
||||||
CHANNEL_PIN: (channelID: string, messageID: string) =>
|
CHANNEL_PIN: (channelID: string, messageID: string) =>
|
||||||
`${baseEndpoints.BASE_URL}/channels/${channelID}/pins/${messageID}`,
|
`${CHANNEL_BASE(channelID)}/pins/${messageID}`,
|
||||||
CHANNEL_PINS: (id: string) => `${baseEndpoints.BASE_URL}/channels/${id}/pins`,
|
CHANNEL_PINS: (channelID: string) => `${CHANNEL_BASE(channelID)}/pins`,
|
||||||
CHANNEL_BULK_DELETE: (id: string) =>
|
CHANNEL_BULK_DELETE: (channelID: string) =>
|
||||||
`${baseEndpoints.BASE_URL}/channels/${id}/messages/bulk-delete`,
|
`${CHANNEL_BASE(channelID)}/messages/bulk-delete`,
|
||||||
CHANNEL_INVITES: (id: string) =>
|
CHANNEL_INVITES: (channelID: string) => `${CHANNEL_BASE(channelID)}/invites`,
|
||||||
`${baseEndpoints.BASE_URL}/channels/${id}/invites`,
|
CHANNEL_WEBHOOKS: (channelID: string) =>
|
||||||
CHANNEL_WEBHOOKS: (id: string) =>
|
`${CHANNEL_BASE(channelID)}/webhooks`,
|
||||||
`${baseEndpoints.BASE_URL}/channels/${id}/webhooks`,
|
|
||||||
CHANNEL_MESSAGE_REACTION_ME: (
|
CHANNEL_MESSAGE_REACTION_ME: (
|
||||||
id: string,
|
channelID: string,
|
||||||
messageID: string,
|
messageID: string,
|
||||||
emoji: string,
|
emoji: string,
|
||||||
) =>
|
) =>
|
||||||
`${baseEndpoints.BASE_URL}/channels/${id}/messages/${messageID}/reactions/${emoji}/@me`,
|
`${CHANNEL_BASE(channelID)}/messages/${messageID}/reactions/${emoji}/@me`,
|
||||||
CHANNEL_MESSAGE_REACTION_USER: (
|
CHANNEL_MESSAGE_REACTION_USER: (
|
||||||
id: string,
|
channelID: string,
|
||||||
messageID: string,
|
messageID: string,
|
||||||
emoji: string,
|
emoji: string,
|
||||||
userId: string,
|
userId: string,
|
||||||
) =>
|
) =>
|
||||||
`${baseEndpoints.BASE_URL}/channels/${id}/messages/${messageID}/reactions/${emoji}/${userId}`,
|
`${
|
||||||
CHANNEL_MESSAGE_REACTIONS: (id: string, messageID: string) =>
|
CHANNEL_BASE(channelID)
|
||||||
`${baseEndpoints.BASE_URL}/channels/${id}/messages/${messageID}/reactions`,
|
}/messages/${messageID}/reactions/${emoji}/${userId}`,
|
||||||
CHANNEL_MESSAGE_REACTION: (id: string, messageID: string, emoji: string) =>
|
CHANNEL_MESSAGE_REACTIONS: (channelID: string, messageID: string) =>
|
||||||
`${baseEndpoints.BASE_URL}/channels/${id}/messages/${messageID}/reactions/${emoji}`,
|
`${CHANNEL_BASE(channelID)}/messages/${messageID}/reactions`,
|
||||||
CHANNEL_FOLLOW: (id: string) =>
|
CHANNEL_MESSAGE_REACTION: (
|
||||||
`${baseEndpoints.BASE_URL}/channels/${id}/followers`,
|
channelID: string,
|
||||||
CHANNEL_MESSAGE_CROSSPOST: (id: string, messageID: string) =>
|
messageID: string,
|
||||||
`${baseEndpoints.BASE_URL}/channels/${id}/messages/${messageID}/crosspost`,
|
emoji: string,
|
||||||
|
) => `${CHANNEL_BASE(channelID)}/messages/${messageID}/reactions/${emoji}`,
|
||||||
|
CHANNEL_FOLLOW: (channelID: string) => `${CHANNEL_BASE(channelID)}/followers`,
|
||||||
|
CHANNEL_MESSAGE_CROSSPOST: (channelID: string, messageID: string) =>
|
||||||
|
`${CHANNEL_BASE(channelID)}/messages/${messageID}/crosspost`,
|
||||||
|
CHANNEL_OVERWRITE: (channelID: string, overwriteID: string) =>
|
||||||
|
`${CHANNEL_BASE(channelID)}/permissions/${overwriteID}`,
|
||||||
|
// Bots SHALL NOT use this endpoint but they can
|
||||||
|
CHANNEL_TYPING: (channelID: string) => `${CHANNEL_BASE(channelID)}/typing`,
|
||||||
|
|
||||||
// Guild Endpoints
|
// Guild Endpoints
|
||||||
GUILDS: `${baseEndpoints.BASE_URL}/guilds`,
|
GUILDS: `${baseEndpoints.BASE_URL}/guilds`,
|
||||||
GUILD: (id: string) => `${GUILDS_BASE(id)}`,
|
GUILD_AUDIT_LOGS: (guildID: string) => `${GUILDS_BASE(guildID)}/audit-logs`,
|
||||||
GUILD_AUDIT_LOGS: (id: string) => `${GUILDS_BASE(id)}/audit-logs`,
|
GUILD_BAN: (guildID: string, userID: string) =>
|
||||||
GUILD_BAN: (id: string, userID: string) =>
|
`${GUILDS_BASE(guildID)}/bans/${userID}`,
|
||||||
`${GUILDS_BASE(id)}/bans/${userID}`,
|
GUILD_BANS: (guildID: string) => `${GUILDS_BASE(guildID)}/bans`,
|
||||||
GUILD_BANS: (id: string) => `${GUILDS_BASE(id)}/bans`,
|
GUILD_BANNER: (guildID: string, icon: string) =>
|
||||||
GUILD_BANNER: (id: string, icon: string) =>
|
`${baseEndpoints.CDN_URL}/banners/${guildID}/${icon}`,
|
||||||
`${baseEndpoints.CDN_URL}/banners/${id}/${icon}`,
|
GUILD_CHANNELS: (guildID: string) => `${GUILDS_BASE(guildID)}/channels`,
|
||||||
GUILD_CHANNELS: (id: string) => `${GUILDS_BASE(id)}/channels`,
|
GUILD_WIDGET: (guildID: string) => `${GUILDS_BASE(guildID)}/widget`,
|
||||||
GUILD_CHANNEL: (id: string) => `${baseEndpoints.BASE_URL}/channels/${id}`,
|
GUILD_EMOJI: (guildID: string, emojiID: string) =>
|
||||||
GUILD_EMBED: (id: string) => `${GUILDS_BASE(id)}/widget`,
|
`${GUILDS_BASE(guildID)}/emojis/${emojiID}`,
|
||||||
GUILD_EMOJI: (id: string, emoji_id: string) =>
|
GUILD_EMOJIS: (guildID: string) => `${GUILDS_BASE(guildID)}/emojis`,
|
||||||
`${GUILDS_BASE(id)}/emojis/${emoji_id}`,
|
GUILD_ICON: (guildID: string, icon: string) =>
|
||||||
GUILD_EMOJIS: (id: string) => `${GUILDS_BASE(id)}/emojis`,
|
`${baseEndpoints.CDN_URL}/icons/${guildID}/${icon}`,
|
||||||
GUILD_ICON: (id: string, icon: string) =>
|
GUILD_INTEGRATION: (guildID: string, integrationID: string) =>
|
||||||
`${baseEndpoints.CDN_URL}/icons/${id}/${icon}`,
|
`${GUILDS_BASE(guildID)}/integrations/${integrationID}`,
|
||||||
GUILD_INTEGRATION: (id: string, integrationID: string) =>
|
GUILD_INTEGRATION_SYNC: (guildID: string, integrationID: string) =>
|
||||||
`${GUILDS_BASE(id)}/integrations/${integrationID}`,
|
`${GUILDS_BASE(guildID)}/integrations/${integrationID}/sync`,
|
||||||
GUILD_INTEGRATION_SYNC: (id: string, integrationID: string) =>
|
GUILD_INTEGRATIONS: (guildID: string) =>
|
||||||
`${GUILDS_BASE(id)}/integrations/${integrationID}/sync`,
|
`${GUILDS_BASE(guildID)}/integrations?include_applications=true`,
|
||||||
GUILD_INTEGRATIONS: (id: string) =>
|
GUILD_INTEGRATION_CREATE: (guildID: string) =>
|
||||||
`${GUILDS_BASE(id)}/integrations?include_applications=true`,
|
`${GUILDS_BASE(guildID)}/integrations`,
|
||||||
GUILD_INVITES: (id: string) => `${GUILDS_BASE(id)}/invites`,
|
GUILD_INVITES: (guildID: string) => `${GUILDS_BASE(guildID)}/invites`,
|
||||||
GUILD_LEAVE: (id: string) =>
|
GUILD_LEAVE: (guildID: string) =>
|
||||||
`${baseEndpoints.BASE_URL}/users/@me/guilds/${id}`,
|
`${baseEndpoints.BASE_URL}/users/@me/guilds/${guildID}`,
|
||||||
GUILD_MEMBER: (id: string, memberID: string) =>
|
GUILD_MEMBER: (guildID: string, userID: string) =>
|
||||||
`${GUILDS_BASE(id)}/members/${memberID}`,
|
`${GUILDS_BASE(guildID)}/members/${userID}`,
|
||||||
GUILD_MEMBER_ROLE: (id: string, memberID: string, roleID: string) =>
|
GUILD_MEMBERS: (guildID: string) => `${GUILDS_BASE(guildID)}/members`,
|
||||||
`${GUILDS_BASE(id)}/members/${memberID}/roles/${roleID}`,
|
GUILD_MEMBER_ROLE: (guildID: string, memberID: string, roleID: string) =>
|
||||||
GUILD_PRUNE: (id: string) => `${GUILDS_BASE(id)}/prune`,
|
`${GUILDS_BASE(guildID)}/members/${memberID}/roles/${roleID}`,
|
||||||
GUILD_REGIONS: (id: string) => `${GUILDS_BASE(id)}/regions`,
|
GUILD_PRUNE: (guildID: string) => `${GUILDS_BASE(guildID)}/prune`,
|
||||||
GUILD_ROLE: (id: string, roleID: string) =>
|
GUILD_REGIONS: (guildID: string) => `${GUILDS_BASE(guildID)}/regions`,
|
||||||
`${GUILDS_BASE(id)}/roles/${roleID}`,
|
GUILD_ROLE: (guildID: string, roleID: string) =>
|
||||||
GUILD_ROLES: (id: string) => `${GUILDS_BASE(id)}/roles`,
|
`${GUILDS_BASE(guildID)}/roles/${roleID}`,
|
||||||
GUILD_SPLASH: (id: string, icon: string) =>
|
GUILD_ROLES: (guildID: string) => `${GUILDS_BASE(guildID)}/roles`,
|
||||||
`${baseEndpoints.CDN_URL}/splashes/${id}/${icon}`,
|
GUILD_SPLASH: (guildID: string, icon: string) =>
|
||||||
GUILD_VANITY_URL: (id: string) => `${GUILDS_BASE(id)}/vanity-url`,
|
`${baseEndpoints.CDN_URL}/splashes/${guildID}/${icon}`,
|
||||||
GUILD_WEBHOOKS: (id: string) => `${GUILDS_BASE(id)}/webhooks`,
|
GUILD_VANITY_URL: (guildID: string) => `${GUILDS_BASE(guildID)}/vanity-url`,
|
||||||
|
GUILD_WEBHOOKS: (guildID: string) => `${GUILDS_BASE(guildID)}/webhooks`,
|
||||||
GUILD_TEMPLATE: (code: string) =>
|
GUILD_TEMPLATE: (code: string) =>
|
||||||
`${baseEndpoints.BASE_URL}/guilds/templates/${code}`,
|
`${baseEndpoints.BASE_URL}/guilds/templates/${code}`,
|
||||||
GUILD_TEMPLATES: (id: string) => `${GUILDS_BASE(id)}/templates`,
|
GUILD_TEMPLATES: (guildID: string) => `${GUILDS_BASE(guildID)}/templates`,
|
||||||
|
GUILD_PREVIEW: (guildID: string) => `${GUILDS_BASE(guildID)}/preview`,
|
||||||
|
|
||||||
WEBHOOK: (id: string, token: string) =>
|
INVITE: (inviteCode: string) =>
|
||||||
`${baseEndpoints.BASE_URL}/webhooks/${id}/${token}`,
|
`${baseEndpoints.BASE_URL}/invites/${inviteCode}`,
|
||||||
WEBHOOK_ID: (id: string) => `${baseEndpoints.BASE_URL}/webhooks/${id}`,
|
|
||||||
WEBHOOK_EDIT: (id: string, token: string, messageID: string) =>
|
WEBHOOK: (webhookID: string, token: string) =>
|
||||||
`${baseEndpoints.BASE_URL}/webhooks/${id}/${token}/messages/${messageID}`,
|
`${baseEndpoints.BASE_URL}/webhooks/${webhookID}/${token}`,
|
||||||
WEBHOOK_DELETE: (id: string, token: string, messageID: string) =>
|
WEBHOOK_ID: (webhookID: string) =>
|
||||||
`${baseEndpoints.BASE_URL}/webhooks/${id}/${token}/messages/${messageID}`,
|
`${baseEndpoints.BASE_URL}/webhooks/${webhookID}`,
|
||||||
|
WEBHOOK_MESSAGE: (webhookID: string, token: string, messageID: string) =>
|
||||||
|
`${baseEndpoints.BASE_URL}/webhooks/${webhookID}/${token}/messages/${messageID}`,
|
||||||
|
WEBHOOK_SLACK: (webhookID: string, token: string) =>
|
||||||
|
`${baseEndpoints.BASE_URL}/webhooks/${webhookID}/${token}/slack`,
|
||||||
|
WEBHOOK_GITHUB: (webhookID: string, token: string) =>
|
||||||
|
`${baseEndpoints.BASE_URL}/webhooks/${webhookID}/${token}/github`,
|
||||||
|
|
||||||
// Application Endpoints
|
// Application Endpoints
|
||||||
COMMANDS: (botID: string) =>
|
COMMANDS: (botID: string) =>
|
||||||
`${baseEndpoints.BASE_URL}/applications/${botID}/commands`,
|
`${baseEndpoints.BASE_URL}/applications/${botID}/commands`,
|
||||||
COMMANDS_GUILD: (botID: string, id: string) =>
|
COMMANDS_GUILD: (botID: string, guildID: string) =>
|
||||||
`${baseEndpoints.BASE_URL}/applications/${botID}/guilds/${id}/commands`,
|
`${baseEndpoints.BASE_URL}/applications/${botID}/guilds/${guildID}/commands`,
|
||||||
COMMANDS_ID: (botID: string, id: string) =>
|
COMMANDS_ID: (botID: string, commandID: string) =>
|
||||||
`${baseEndpoints.BASE_URL}/applications/${botID}/commands/${id}`,
|
`${baseEndpoints.BASE_URL}/applications/${botID}/commands/${commandID}`,
|
||||||
COMMANDS_GUILD_ID: (botID: string, id: string, guildID: string) =>
|
COMMANDS_GUILD_ID: (botID: string, commandID: string, guildID: string) =>
|
||||||
`${baseEndpoints.BASE_URL}/applications/${botID}/guilds/${guildID}/commands/${id}`,
|
`${baseEndpoints.BASE_URL}/applications/${botID}/guilds/${guildID}/commands/${commandID}`,
|
||||||
|
|
||||||
// Interaction Endpoints
|
// Interaction Endpoints
|
||||||
INTERACTION_ID_TOKEN: (id: string, token: string) =>
|
INTERACTION_ID_TOKEN: (interactionID: string, token: string) =>
|
||||||
`${baseEndpoints.BASE_URL}/interactions/${id}/${token}/callback`,
|
`${baseEndpoints.BASE_URL}/interactions/${interactionID}/${token}/callback`,
|
||||||
INTERACTION_ORIGINAL_ID_TOKEN: (id: string, token: string) =>
|
INTERACTION_ORIGINAL_ID_TOKEN: (interactionID: string, token: string) =>
|
||||||
`${baseEndpoints.BASE_URL}/webhooks/${id}/${token}/messages/@original`,
|
`${baseEndpoints.BASE_URL}/webhooks/${interactionID}/${token}/messages/@original`,
|
||||||
INTERACTION_ID_TOKEN_MESSAGEID: (
|
INTERACTION_ID_TOKEN_MESSAGEID: (
|
||||||
id: string,
|
applicationID: string,
|
||||||
token: string,
|
token: string,
|
||||||
messageID: string,
|
messageID: string,
|
||||||
) =>
|
) =>
|
||||||
`${baseEndpoints.BASE_URL}/webhooks/${id}/${token}/messages/${messageID}`,
|
`${baseEndpoints.BASE_URL}/webhooks/${applicationID}/${token}/messages/${messageID}`,
|
||||||
|
|
||||||
// User endpoints
|
// User endpoints
|
||||||
USER: (id: string) => `${baseEndpoints.BASE_URL}/users/${id}`,
|
USER: (userID: string) => `${baseEndpoints.BASE_URL}/users/${userID}`,
|
||||||
USER_BOT: `${baseEndpoints.BASE_URL}/users/@me`,
|
USER_BOT: `${baseEndpoints.BASE_URL}/users/@me`,
|
||||||
USER_AVATAR: (id: string, icon: string) =>
|
USER_GUILDS: `${baseEndpoints.BASE_URL}/@me/guilds`,
|
||||||
`${baseEndpoints.CDN_URL}/avatars/${id}/${icon}`,
|
USER_AVATAR: (userID: string, icon: string) =>
|
||||||
|
`${baseEndpoints.CDN_URL}/avatars/${userID}/${icon}`,
|
||||||
USER_DEFAULT_AVATAR: (icon: number) =>
|
USER_DEFAULT_AVATAR: (icon: number) =>
|
||||||
`${baseEndpoints.CDN_URL}/embed/avatars/${icon}.png`,
|
`${baseEndpoints.CDN_URL}/embed/avatars/${icon}.png`,
|
||||||
USER_CREATE_DM: `${baseEndpoints.BASE_URL}/users/@me/channels`,
|
USER_DM: `${baseEndpoints.BASE_URL}/users/@me/channels`,
|
||||||
|
USER_CONNECTIONS: `${baseEndpoints.BASE_URL}/users/@me/connections`,
|
||||||
|
USER_NICK: (guildID: string) => `${GUILDS_BASE(guildID)}/members/@me/nick`,
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user