mirror of
https://github.com/discordeno/discordeno.git
synced 2026-06-16 03:18:17 +00:00
Merge branch 'main' of https://github.com/discordeno/discordeno into buttons-dropdowns
This commit is contained in:
+1
-1
@@ -1 +1 @@
|
||||
* @ayntee @Skillz4Killz @itohatweb
|
||||
* @Skillz4Killz @itohatweb
|
||||
|
||||
@@ -17,7 +17,7 @@ jobs:
|
||||
- name: Cache dependencies
|
||||
run: deno cache --no-check mod.ts
|
||||
- name: Run test script for maintainers
|
||||
if: ${{ github.actor == 'ayntee' || github.actor == 'Skillz4Killz' || github.actor == 'itohatweb' }}
|
||||
if: ${{ github.actor == 'Skillz4Killz' || github.actor == 'itohatweb' }}
|
||||
run: deno test --unstable --coverage=coverage -A --no-check tests/mod.ts
|
||||
- name: Run test script if label added
|
||||
if: ${{ github.event_name == 'pull_request' && github.event.action == 'labeled' && github.event.label.name == 'run-tests' }}
|
||||
|
||||
@@ -6,6 +6,7 @@ export * from "./src/rest/mod.ts";
|
||||
export * from "./src/structures/channel.ts";
|
||||
export * from "./src/structures/guild.ts";
|
||||
export * from "./src/structures/member.ts";
|
||||
export * from "./src/structures/message.ts";
|
||||
export * from "./src/structures/mod.ts";
|
||||
export * from "./src/structures/role.ts";
|
||||
export * from "./src/types/mod.ts";
|
||||
|
||||
+32
-19
@@ -65,31 +65,42 @@ export function setApplicationId(id: string) {
|
||||
*
|
||||
* Advanced Devs: This function will allow you to have an insane amount of customization potential as when you get to large bots you need to be able to optimize every tiny detail to make you bot work the way you need.
|
||||
*/
|
||||
export async function startBigBrainBot(data: BigBrainBotConfig) {
|
||||
if (data.secretKey) secretKey = data.secretKey;
|
||||
if (data.restURL) baseEndpoints.BASE_URL = data.restURL;
|
||||
if (data.cdnURL) baseEndpoints.CDN_URL = data.cdnURL;
|
||||
if (data.eventHandlers) eventHandlers = data.eventHandlers;
|
||||
if (data.compress) {
|
||||
ws.identifyPayload.compress = data.compress;
|
||||
}
|
||||
export async function startBigBrainBot(options: BigBrainBotConfig) {
|
||||
rest.token = `Bot ${options.token}`;
|
||||
|
||||
ws.identifyPayload.intents = data.intents.reduce(
|
||||
(
|
||||
bits,
|
||||
next,
|
||||
) => (bits |= typeof next === "string"
|
||||
? DiscordGatewayIntents[next]
|
||||
: next),
|
||||
0,
|
||||
);
|
||||
if (options.secretKey) secretKey = options.secretKey;
|
||||
if (options.restURL) baseEndpoints.BASE_URL = options.restURL;
|
||||
if (options.cdnURL) baseEndpoints.CDN_URL = options.cdnURL;
|
||||
if (options.eventHandlers) eventHandlers = options.eventHandlers;
|
||||
|
||||
// PROXY DOESNT NEED US SPAWNING SHARDS
|
||||
if (!data.wsPort) {
|
||||
if (!options.wsPort) {
|
||||
ws.identifyPayload.token = `Bot ${options.token}`;
|
||||
|
||||
if (options.compress) {
|
||||
ws.identifyPayload.compress = options.compress;
|
||||
}
|
||||
|
||||
ws.identifyPayload.intents = options.intents.reduce(
|
||||
(
|
||||
bits,
|
||||
next,
|
||||
) => (bits |= typeof next === "string"
|
||||
? DiscordGatewayIntents[next]
|
||||
: next),
|
||||
0,
|
||||
);
|
||||
|
||||
// Initial API connection to get info about bots connection
|
||||
ws.botGatewayData = await getGatewayBot();
|
||||
ws.maxShards = ws.maxShards ||
|
||||
ws.botGatewayData.shards;
|
||||
ws.lastShardId = options.lastShardId || ws.botGatewayData.shards;
|
||||
// Explicitly append gateway version and encoding
|
||||
ws.botGatewayData.url += `?v=${GATEWAY_VERSION}&encoding=json`;
|
||||
proxyWSURL = ws.botGatewayData.url;
|
||||
ws.spawnShards(data.firstShardId);
|
||||
|
||||
ws.spawnShards(options.firstShardId);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -105,6 +116,8 @@ export interface BigBrainBotConfig extends BotConfig {
|
||||
firstShardId: number;
|
||||
/** The last shard to start for this worker. By default it will be 25 + the firstShardId. */
|
||||
lastShardId?: number;
|
||||
/** The maximum shard Id number. Useful for zero-downtime updates or resharding. */
|
||||
maxShards?: number;
|
||||
/** This can be used to forward the ws handling to a proxy. It will disable the sharding done by the bot side. */
|
||||
wsPort?: number;
|
||||
/** This can be used to forward the REST handling to a proxy. */
|
||||
|
||||
@@ -2,16 +2,11 @@ import { eventHandlers } from "../../bot.ts";
|
||||
import { cacheHandlers } from "../../cache.ts";
|
||||
import { structures } from "../../structures/mod.ts";
|
||||
import { DiscordGatewayPayload } from "../../types/gateway/gateway_payload.ts";
|
||||
import {
|
||||
DiscordVoiceState,
|
||||
VoiceState,
|
||||
} from "../../types/voice/voice_state.ts";
|
||||
import { snakeKeysToCamelCase } from "../../util/utils.ts";
|
||||
import { VoiceState } from "../../types/voice/voice_state.ts";
|
||||
|
||||
export async function handleVoiceStateUpdate(data: DiscordGatewayPayload) {
|
||||
const payload = snakeKeysToCamelCase<VoiceState>(
|
||||
data.d as DiscordVoiceState,
|
||||
);
|
||||
const payload = data.d as VoiceState;
|
||||
|
||||
if (!payload.guildId) return;
|
||||
|
||||
const guild = await cacheHandlers.get("guilds", payload.guildId);
|
||||
|
||||
@@ -29,8 +29,8 @@ export async function cloneChannel(channelId: string, reason?: string) {
|
||||
) => ({
|
||||
id: overwrite.id,
|
||||
type: overwrite.type,
|
||||
allow: calculatePermissions(BigInt(overwrite.allow)),
|
||||
deny: calculatePermissions(BigInt(overwrite.deny)),
|
||||
allow: calculatePermissions(overwrite.allow),
|
||||
deny: calculatePermissions(overwrite.deny),
|
||||
})),
|
||||
};
|
||||
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
import { applicationId } from "../../bot.ts";
|
||||
import { rest } from "../../rest/rest.ts";
|
||||
import { ApplicationCommandPermissions } from "../../types/interactions/application_command_permissions.ts";
|
||||
import { endpoints } from "../../util/constants.ts";
|
||||
import { camelKeysToSnakeCase } from "../../util/utils.ts";
|
||||
|
||||
/** Batch edits permissions for all commands in a guild. Takes an array of partial GuildApplicationCommandPermissions objects including `id` and `permissions`. */
|
||||
export async function batchEditSlashCommandPermissions(
|
||||
guildId: string,
|
||||
options: { id: string; permissions: ApplicationCommandPermissions[] }[],
|
||||
) {
|
||||
return await rest.runMethod(
|
||||
"put",
|
||||
endpoints.COMMANDS_PERMISSIONS(applicationId, guildId),
|
||||
camelKeysToSnakeCase(options),
|
||||
);
|
||||
}
|
||||
@@ -21,7 +21,7 @@ import {
|
||||
*/
|
||||
export async function createSlashCommand(
|
||||
options: CreateGlobalApplicationCommand,
|
||||
guildId: string,
|
||||
guildId?: string,
|
||||
) {
|
||||
validateSlashCommands([options], true);
|
||||
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
import { applicationId } from "../../bot.ts";
|
||||
import { rest } from "../../rest/rest.ts";
|
||||
import { ApplicationCommandPermissions } from "../../types/interactions/application_command_permissions.ts";
|
||||
import { endpoints } from "../../util/constants.ts";
|
||||
import { camelKeysToSnakeCase } from "../../util/utils.ts";
|
||||
|
||||
/** Edits command permissions for a specific command for your application in a guild. */
|
||||
export async function editSlashCommandPermissions(
|
||||
guildId: string,
|
||||
commandId: string,
|
||||
options: ApplicationCommandPermissions[],
|
||||
) {
|
||||
return await rest.runMethod(
|
||||
"put",
|
||||
endpoints.COMMANDS_PERMISSION(applicationId, guildId, commandId),
|
||||
{ permissions: camelKeysToSnakeCase(options) },
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
import { applicationId } from "../../bot.ts";
|
||||
import { rest } from "../../rest/rest.ts";
|
||||
import { GuildApplicationCommandPermissions } from "../../types/interactions/guild_application_command_permissions.ts";
|
||||
import { endpoints } from "../../util/constants.ts";
|
||||
|
||||
/** Fetches command permissions for a specific command for your application in a guild. Returns a GuildApplicationCommandPermissions object. */
|
||||
export async function getSlashCommandPermission(
|
||||
guildId: string,
|
||||
commandId: string,
|
||||
) {
|
||||
return await rest.runMethod<GuildApplicationCommandPermissions>(
|
||||
"get",
|
||||
endpoints.COMMANDS_PERMISSION(applicationId, guildId, commandId),
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
import { applicationId } from "../../bot.ts";
|
||||
import { rest } from "../../rest/rest.ts";
|
||||
import { GuildApplicationCommandPermissions } from "../../types/interactions/guild_application_command_permissions.ts";
|
||||
import { endpoints } from "../../util/constants.ts";
|
||||
|
||||
/** Fetches command permissions for all commands for your application in a guild. Returns an array of GuildApplicationCommandPermissions objects. */
|
||||
export async function getSlashCommandPermissions(guildId: string) {
|
||||
return await rest.runMethod<GuildApplicationCommandPermissions[]>(
|
||||
"get",
|
||||
endpoints.COMMANDS_PERMISSIONS(applicationId, guildId),
|
||||
);
|
||||
}
|
||||
@@ -1,9 +1,9 @@
|
||||
import { rest } from "../../rest/rest.ts";
|
||||
import { DiscordValidateDiscoverySearchTerm } from "../../types/discovery/validate_discovery_search_term.ts";
|
||||
import { ValidateDiscoverySearchTerm } from "../../types/discovery/validate_discovery_search_term.ts";
|
||||
import { endpoints } from "../../util/constants.ts";
|
||||
|
||||
export async function validDiscoveryTerm(term: string) {
|
||||
const result = await rest.runMethod<DiscordValidateDiscoverySearchTerm>(
|
||||
const result = await rest.runMethod<ValidateDiscoverySearchTerm>(
|
||||
"get",
|
||||
endpoints.DISCOVERY_VALID_TERM,
|
||||
{ term },
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
import { rest } from "../../rest/rest.ts";
|
||||
import { endpoints } from "../../util/constants.ts";
|
||||
|
||||
/** Delete a guild permanently. User must be owner. Returns 204 No Content on success. Fires a Guild Delete Gateway event.
|
||||
*/
|
||||
export async function deleteServer(guildId: string) {
|
||||
/** Delete a guild permanently. User must be owner. Returns 204 No Content on success. Fires a Guild Delete Gateway event. */
|
||||
export async function deleteGuild(guildId: string) {
|
||||
return await rest.runMethod<undefined>(
|
||||
"delete",
|
||||
endpoints.GUILDS_BASE(guildId),
|
||||
@@ -12,5 +12,5 @@ export async function getWidget(guildId: string, options?: { force: boolean }) {
|
||||
if (!guild?.widgetEnabled) throw new Error(Errors.GUILD_WIDGET_NOT_ENABLED);
|
||||
}
|
||||
|
||||
return await rest.runMethod("get", `${endpoints.GUILD_WIDGET(guildId)}.json`) as GuildWidgetDetails;
|
||||
return await rest.runMethod<GuildWidgetDetails>("get", `${endpoints.GUILD_WIDGET(guildId)}.json`);
|
||||
}
|
||||
|
||||
@@ -1,8 +1,11 @@
|
||||
import { cache } from "../../cache.ts";
|
||||
import { DiscordenoMember } from "../../structures/member.ts";
|
||||
import { DiscordGatewayOpcodes } from "../../types/codes/gateway_opcodes.ts";
|
||||
import { DiscordGatewayIntents } from "../../types/gateway/gateway_intents.ts";
|
||||
import { RequestGuildMembers } from "../../types/guilds/request_guild_members.ts";
|
||||
import type { RequestGuildMembers } from "../../types/guilds/request_guild_members.ts";
|
||||
import { Errors } from "../../types/misc/errors.ts";
|
||||
import { Collection } from "../../util/collection.ts";
|
||||
import { sendShardMessage } from "../../ws/send_shard_message.ts";
|
||||
import { ws } from "../../ws/ws.ts";
|
||||
|
||||
/**
|
||||
@@ -16,12 +19,12 @@ import { ws } from "../../ws/ws.ts";
|
||||
export function fetchMembers(
|
||||
guildId: string,
|
||||
shardId: number,
|
||||
options?: RequestGuildMembers,
|
||||
options?: Omit<RequestGuildMembers, "guildId">,
|
||||
) {
|
||||
// You can request 1 member without the intent
|
||||
if (
|
||||
(!options?.limit || options.limit > 1) &&
|
||||
!(ws.identifyPayload.intents && DiscordGatewayIntents.GUILD_MEMBERS)
|
||||
!(ws.identifyPayload.intents & DiscordGatewayIntents.GUILD_MEMBERS)
|
||||
) {
|
||||
throw new Error(Errors.MISSING_INTENT_GUILD_MEMBERS);
|
||||
}
|
||||
@@ -31,21 +34,20 @@ export function fetchMembers(
|
||||
}
|
||||
|
||||
return new Promise((resolve) => {
|
||||
return requestAllMembers(guildId, shardId, resolve, options);
|
||||
const nonce = `${guildId}-${Date.now()}`;
|
||||
cache.fetchAllMembersProcessingRequests.set(nonce, resolve);
|
||||
|
||||
sendShardMessage(shardId, {
|
||||
op: DiscordGatewayOpcodes.RequestGuildMembers,
|
||||
d: {
|
||||
guild_id: guildId,
|
||||
// If a query is provided use it, OR if a limit is NOT provided use ""
|
||||
query: options?.query || (options?.limit ? undefined : ""),
|
||||
limit: options?.limit || 0,
|
||||
presences: options?.presences || false,
|
||||
user_ids: options?.userIds,
|
||||
nonce,
|
||||
},
|
||||
});
|
||||
}) as Promise<Collection<string, DiscordenoMember>>;
|
||||
}
|
||||
|
||||
// TODO: finish implementing this
|
||||
function requestAllMembers(
|
||||
_guildId: string,
|
||||
_shardId: number,
|
||||
_resolve: (
|
||||
value:
|
||||
| Collection<string, DiscordenoMember>
|
||||
| PromiseLike<Collection<string, DiscordenoMember>>,
|
||||
) => void,
|
||||
// deno-lint-ignore no-explicit-any
|
||||
_options: any,
|
||||
): void {
|
||||
throw new Error("Function not implemented.");
|
||||
}
|
||||
|
||||
@@ -19,7 +19,10 @@ import { ws } from "../../ws/ws.ts";
|
||||
* REST(this function): 50/s global(across all shards) rate limit with ALL requests this included
|
||||
* GW(fetchMembers): 120/m(PER shard) rate limit. Meaning if you have 8 shards your limit is 960/m.
|
||||
*/
|
||||
export async function getMembers(guildId: string, options?: ListGuildMembers) {
|
||||
export async function getMembers(
|
||||
guildId: string,
|
||||
options?: ListGuildMembers & { addToCache?: boolean },
|
||||
) {
|
||||
if (!(ws.identifyPayload.intents && DiscordGatewayIntents.GUILD_MEMBERS)) {
|
||||
throw new Error(Errors.MISSING_INTENT_GUILD_MEMBERS);
|
||||
}
|
||||
@@ -61,11 +64,13 @@ export async function getMembers(guildId: string, options?: ListGuildMembers) {
|
||||
guildId,
|
||||
);
|
||||
|
||||
await cacheHandlers.set(
|
||||
"members",
|
||||
discordenoMember.id,
|
||||
discordenoMember,
|
||||
);
|
||||
if (options?.addToCache !== false) {
|
||||
await cacheHandlers.set(
|
||||
"members",
|
||||
discordenoMember.id,
|
||||
discordenoMember,
|
||||
);
|
||||
}
|
||||
|
||||
return discordenoMember;
|
||||
}),
|
||||
|
||||
@@ -1,37 +0,0 @@
|
||||
import { cacheHandlers } from "../../cache.ts";
|
||||
import { DiscordenoMember } from "../../structures/member.ts";
|
||||
import { Collection } from "../../util/collection.ts";
|
||||
|
||||
/** Returns guild member objects for the specified user by their nickname/username.
|
||||
*
|
||||
* ⚠️ **ADVANCED USE ONLY: Your members will be cached in your guild most likely. Only use this when you are absolutely sure the member is not cached.**
|
||||
*/
|
||||
export async function getMembersByQuery(
|
||||
guildId: string,
|
||||
name: string,
|
||||
limit = 1,
|
||||
) {
|
||||
const guild = await cacheHandlers.get("guilds", guildId);
|
||||
if (!guild) return;
|
||||
|
||||
return new Promise((resolve) => {
|
||||
return requestAllMembers(guild.id, guild.shardId, resolve, {
|
||||
query: name,
|
||||
limit,
|
||||
});
|
||||
}) as Promise<Collection<string, DiscordenoMember>>;
|
||||
}
|
||||
|
||||
// TODO: implement this
|
||||
function requestAllMembers(
|
||||
_id: string,
|
||||
_shardId: number,
|
||||
_resolve: (
|
||||
value:
|
||||
| Collection<string, DiscordenoMember>
|
||||
| PromiseLike<Collection<string, DiscordenoMember>>,
|
||||
) => void,
|
||||
_arg3: { query: string; limit: number },
|
||||
): void {
|
||||
throw new Error("Function not implemented.");
|
||||
}
|
||||
@@ -1,12 +1,18 @@
|
||||
import { rest } from "../../rest/rest.ts";
|
||||
import { endpoints } from "../../util/constants.ts";
|
||||
import { requireBotChannelPermissions } from "../../util/permissions.ts";
|
||||
|
||||
/** Removes a reaction from the bot on this message. Reaction takes the form of **name:id** for custom guild emoji, or Unicode characters. */
|
||||
/** Removes a reaction from the given user on this message, defaults to bot. Reaction takes the form of **name:id** for custom guild emoji, or Unicode characters. */
|
||||
export async function removeReaction(
|
||||
channelId: string,
|
||||
messageId: string,
|
||||
reaction: string,
|
||||
options?: { userId?: string },
|
||||
) {
|
||||
if (options?.userId) {
|
||||
await requireBotChannelPermissions(channelId, ["MANAGE_MESSAGES"]);
|
||||
}
|
||||
|
||||
if (reaction.startsWith("<:")) {
|
||||
reaction = reaction.substring(2, reaction.length - 1);
|
||||
} else if (reaction.startsWith("<a:")) {
|
||||
@@ -15,6 +21,13 @@ export async function removeReaction(
|
||||
|
||||
return await rest.runMethod<undefined>(
|
||||
"delete",
|
||||
endpoints.CHANNEL_MESSAGE_REACTION_ME(channelId, messageId, reaction),
|
||||
options?.userId
|
||||
? endpoints.CHANNEL_MESSAGE_REACTION_USER(
|
||||
channelId,
|
||||
messageId,
|
||||
reaction,
|
||||
options.userId,
|
||||
)
|
||||
: endpoints.CHANNEL_MESSAGE_REACTION_ME(channelId, messageId, reaction),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,29 +0,0 @@
|
||||
import { rest } from "../../rest/rest.ts";
|
||||
import { endpoints } from "../../util/constants.ts";
|
||||
import { requireBotChannelPermissions } from "../../util/permissions.ts";
|
||||
|
||||
/** Removes a reaction from the specified user on this message. Reaction takes the form of **name:id** for custom guild emoji, or Unicode characters. */
|
||||
export async function removeUserReaction(
|
||||
channelId: string,
|
||||
messageId: string,
|
||||
reaction: string,
|
||||
userId: string,
|
||||
) {
|
||||
await requireBotChannelPermissions(channelId, ["MANAGE_MESSAGES"]);
|
||||
|
||||
if (reaction.startsWith("<:")) {
|
||||
reaction = reaction.substring(2, reaction.length - 1);
|
||||
} else if (reaction.startsWith("<a:")) {
|
||||
reaction = reaction.substring(3, reaction.length - 1);
|
||||
}
|
||||
|
||||
return await rest.runMethod<undefined>(
|
||||
"delete",
|
||||
endpoints.CHANNEL_MESSAGE_REACTION_USER(
|
||||
channelId,
|
||||
messageId,
|
||||
reaction,
|
||||
userId,
|
||||
),
|
||||
);
|
||||
}
|
||||
@@ -5,7 +5,7 @@ import { DiscordChannelTypes } from "../../types/channels/channel_types.ts";
|
||||
import { DiscordAllowedMentionsTypes } from "../../types/messages/allowed_mentions_types.ts";
|
||||
import { ButtonStyles } from "../../types/messages/components/button_styles.ts";
|
||||
import { CreateMessage } from "../../types/messages/create_message.ts";
|
||||
import { DiscordMessage, Message } from "../../types/messages/message.ts";
|
||||
import { Message } from "../../types/messages/message.ts";
|
||||
import { Errors } from "../../types/misc/errors.ts";
|
||||
import { PermissionStrings } from "../../types/permissions/permission_strings.ts";
|
||||
import { endpoints } from "../../util/constants.ts";
|
||||
@@ -153,7 +153,7 @@ export async function sendMessage(
|
||||
const result = await rest.runMethod<Message>(
|
||||
"post",
|
||||
endpoints.CHANNEL_MESSAGES(channelId),
|
||||
camelKeysToSnakeCase<DiscordMessage>({
|
||||
camelKeysToSnakeCase({
|
||||
...content,
|
||||
...(content.messageReference?.messageId
|
||||
? {
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { eventHandlers } from "../../bot.ts";
|
||||
import { DiscordGatewayOpcodes } from "../../types/codes/gateway_opcodes.ts";
|
||||
import type { StatusUpdate } from "../../types/gateway/status_update.ts";
|
||||
import { sendShardMessage } from "../../ws/send_shard_message.ts";
|
||||
import { ws } from "../../ws/ws.ts";
|
||||
|
||||
export function editBotStatus(data: Omit<StatusUpdate, "afk" | "since">) {
|
||||
@@ -10,7 +11,7 @@ export function editBotStatus(data: Omit<StatusUpdate, "afk" | "since">) {
|
||||
`Running forEach loop in editBotStatus function.`,
|
||||
);
|
||||
|
||||
shard.queue.push({
|
||||
sendShardMessage(shard, {
|
||||
op: DiscordGatewayOpcodes.StatusUpdate,
|
||||
d: {
|
||||
since: null,
|
||||
@@ -18,6 +19,5 @@ export function editBotStatus(data: Omit<StatusUpdate, "afk" | "since">) {
|
||||
...data,
|
||||
},
|
||||
});
|
||||
ws.processQueue(shard.id);
|
||||
});
|
||||
}
|
||||
|
||||
+19
-14
@@ -13,15 +13,24 @@ import { getPins } from "./channels/get_pins.ts";
|
||||
import { isChannelSynced } from "./channels/is_channel_synced.ts";
|
||||
import { startTyping } from "./channels/start_typing.ts";
|
||||
import { swapChannels } from "./channels/swap_channels.ts";
|
||||
import { batchEditSlashCommandPermissions } from "./commands/batch_edit_slash_command_permissions.ts";
|
||||
import { createSlashCommand } from "./commands/create_slash_command.ts";
|
||||
import { deleteSlashCommand } from "./commands/delete_slash_command.ts";
|
||||
import { deleteSlashResponse } from "./commands/delete_slash_response.ts";
|
||||
import { editSlashCommandPermissions } from "./commands/edit_slash_command_permissions.ts";
|
||||
import { editSlashResponse } from "./commands/edit_slash_response.ts";
|
||||
import { getSlashCommand } from "./commands/get_slash_command.ts";
|
||||
import { getSlashCommands } from "./commands/get_slash_commands.ts";
|
||||
import { getSlashCommandPermission } from "./commands/get_slash_command_permission.ts";
|
||||
import { getSlashCommandPermissions } from "./commands/get_slash_command_permissions.ts";
|
||||
import { sendInteractionResponse } from "./commands/send_interaction_response.ts";
|
||||
import { upsertSlashCommand } from "./commands/upsert_slash_command.ts";
|
||||
import { upsertSlashCommands } from "./commands/upsert_slash_commands.ts";
|
||||
import { addDiscoverySubcategory } from "./discovery/add_discovery_subcategory.ts";
|
||||
import { editDiscovery } from "./discovery/edit_discovery.ts";
|
||||
import { getDiscoveryCategories } from "./discovery/get_discovery_categories.ts";
|
||||
import { removeDiscoverySubcategory } from "./discovery/remove_discovery_subcategory.ts";
|
||||
import { validDiscoveryTerm } from "./discovery/valid_discovery_term.ts";
|
||||
import { createEmoji } from "./emojis/create_emoji.ts";
|
||||
import { deleteEmoji } from "./emojis/delete_emoji.ts";
|
||||
import { editEmoji } from "./emojis/edit_emoji.ts";
|
||||
@@ -29,7 +38,7 @@ import { emojiURL } from "./emojis/emoji_url.ts";
|
||||
import { getEmoji } from "./emojis/get_emoji.ts";
|
||||
import { getEmojis } from "./emojis/get_emojis.ts";
|
||||
import { createGuild } from "./guilds/create_guild.ts";
|
||||
import { deleteServer } from "./guilds/delete_server.ts";
|
||||
import { deleteGuild } from "./guilds/delete_guild.ts";
|
||||
import { editGuild } from "./guilds/edit_guild.ts";
|
||||
import { editWelcomeScreen } from "./guilds/edit_welcome_screen.ts";
|
||||
import { editWidget } from "./guilds/edit_widget.ts";
|
||||
@@ -66,7 +75,6 @@ import { editMember } from "./members/edit_member.ts";
|
||||
import { fetchMembers } from "./members/fetch_members.ts";
|
||||
import { getMember } from "./members/get_member.ts";
|
||||
import { getMembers } from "./members/get_members.ts";
|
||||
import { getMembersByQuery } from "./members/get_members_by_query.ts";
|
||||
import { kick, kickMember } from "./members/kick_member.ts";
|
||||
import { moveMember } from "./members/move_member.ts";
|
||||
import { pruneMembers } from "./members/prune_members.ts";
|
||||
@@ -85,7 +93,6 @@ import { publishMessage } from "./messages/publish_message.ts";
|
||||
import { removeAllReactions } from "./messages/remove_all_reactions.ts";
|
||||
import { removeReaction } from "./messages/remove_reaction.ts";
|
||||
import { removeReactionEmoji } from "./messages/remove_reaction_emoji.ts";
|
||||
import { removeUserReaction } from "./messages/remove_user_reaction.ts";
|
||||
import { sendMessage } from "./messages/send_message.ts";
|
||||
import { unpin, unpinMessage } from "./messages/unpin_message.ts";
|
||||
import { editBotStatus } from "./misc/edit_bot_status.ts";
|
||||
@@ -115,11 +122,6 @@ import { executeWebhook } from "./webhooks/execute_webhook.ts";
|
||||
import { getWebhook } from "./webhooks/get_webhook.ts";
|
||||
import { getWebhooks } from "./webhooks/get_webhooks.ts";
|
||||
import { getWebhookWithToken } from "./webhooks/get_webhook_with_token.ts";
|
||||
import { addDiscoverySubcategory } from "./discovery/add_discovery_subcategory.ts";
|
||||
import { editDiscovery } from "./discovery/edit_discovery.ts";
|
||||
import { getDiscoveryCategories } from "./discovery/get_discovery_categories.ts";
|
||||
import { removeDiscoverySubcategory } from "./discovery/remove_discovery_subcategory.ts";
|
||||
import { validDiscoveryTerm } from "./discovery/valid_discovery_term.ts";
|
||||
|
||||
export {
|
||||
addDiscoverySubcategory,
|
||||
@@ -129,6 +131,7 @@ export {
|
||||
avatarURL,
|
||||
ban,
|
||||
banMember,
|
||||
batchEditSlashCommandPermissions,
|
||||
categoryChildren,
|
||||
channelOverwriteHasPermission,
|
||||
createChannel,
|
||||
@@ -143,13 +146,13 @@ export {
|
||||
deleteChannel,
|
||||
deleteChannelOverwrite,
|
||||
deleteEmoji,
|
||||
deleteGuild,
|
||||
deleteGuildTemplate,
|
||||
deleteIntegration,
|
||||
deleteInvite,
|
||||
deleteMessage,
|
||||
deleteMessages,
|
||||
deleteRole,
|
||||
deleteServer,
|
||||
deleteSlashCommand,
|
||||
deleteSlashResponse,
|
||||
deleteWebhook,
|
||||
@@ -198,7 +201,6 @@ export {
|
||||
getInvites,
|
||||
getMember,
|
||||
getMembers,
|
||||
getMembersByQuery,
|
||||
getMessage,
|
||||
getMessages,
|
||||
getPins,
|
||||
@@ -206,6 +208,8 @@ export {
|
||||
getReactions,
|
||||
getRoles,
|
||||
getSlashCommand,
|
||||
getSlashCommandPermission,
|
||||
getSlashCommandPermissions,
|
||||
getSlashCommands,
|
||||
getTemplate,
|
||||
getUser,
|
||||
@@ -235,7 +239,6 @@ export {
|
||||
removeReaction,
|
||||
removeReactionEmoji,
|
||||
removeRole,
|
||||
removeUserReaction,
|
||||
sendDirectMessage,
|
||||
sendInteractionResponse,
|
||||
sendMessage,
|
||||
@@ -272,6 +275,10 @@ export let helpers = {
|
||||
deleteSlashCommand,
|
||||
deleteSlashResponse,
|
||||
editSlashResponse,
|
||||
getSlashCommandPermission,
|
||||
getSlashCommandPermissions,
|
||||
batchEditSlashCommandPermissions,
|
||||
editSlashCommandPermissions,
|
||||
sendInteractionResponse,
|
||||
getSlashCommand,
|
||||
getSlashCommands,
|
||||
@@ -286,7 +293,7 @@ export let helpers = {
|
||||
// guilds
|
||||
categoryChildren,
|
||||
createGuild,
|
||||
deleteServer,
|
||||
deleteGuild,
|
||||
editGuild,
|
||||
editWidget,
|
||||
editWelcomeScreen,
|
||||
@@ -332,7 +339,6 @@ export let helpers = {
|
||||
editMember,
|
||||
fetchMembers,
|
||||
getMember,
|
||||
getMembersByQuery,
|
||||
getMembers,
|
||||
kickMember,
|
||||
moveMember,
|
||||
@@ -353,7 +359,6 @@ export let helpers = {
|
||||
removeAllReactions,
|
||||
removeReactionEmoji,
|
||||
removeReaction,
|
||||
removeUserReaction,
|
||||
sendMessage,
|
||||
unpinMessage,
|
||||
// misc
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { botId, eventHandlers } from "../bot.ts";
|
||||
import { cache, cacheHandlers } from "../cache.ts";
|
||||
import { deleteServer } from "../helpers/guilds/delete_server.ts";
|
||||
import { deleteGuild } from "../helpers/guilds/delete_guild.ts";
|
||||
import { editGuild } from "../helpers/guilds/edit_guild.ts";
|
||||
import { getAuditLogs } from "../helpers/guilds/get_audit_logs.ts";
|
||||
import { getBan } from "../helpers/guilds/get_ban.ts";
|
||||
@@ -79,7 +79,7 @@ const baseGuild: Partial<DiscordenoGuild> = {
|
||||
return guildSplashURL(this.id!, this.splash!, size, format);
|
||||
},
|
||||
delete() {
|
||||
return deleteServer(this.id!);
|
||||
return deleteGuild(this.id!);
|
||||
},
|
||||
edit(options) {
|
||||
return editGuild(this.id!, options);
|
||||
@@ -272,7 +272,7 @@ export interface DiscordenoGuild extends
|
||||
format?: DiscordImageFormat,
|
||||
): string | undefined;
|
||||
/** Delete a guild permanently. User must be owner. Returns 204 No Content on success. Fires a Guild Delete Gateway event. */
|
||||
delete(): ReturnType<typeof deleteServer>;
|
||||
delete(): ReturnType<typeof deleteGuild>;
|
||||
/** Leave a guild */
|
||||
leave(): ReturnType<typeof leaveGuild>;
|
||||
/** Edit the server. Requires the MANAGE_GUILD permission. */
|
||||
|
||||
@@ -121,8 +121,8 @@ const baseMessage: Partial<DiscordenoMessage> = {
|
||||
removeReactionEmoji(reaction) {
|
||||
return removeReactionEmoji(this.channelId!, this.id!, reaction);
|
||||
},
|
||||
removeReaction(reaction) {
|
||||
return removeReaction(this.channelId!, this.id!, reaction);
|
||||
removeReaction(reaction, userId) {
|
||||
return removeReaction(this.channelId!, this.id!, reaction, { userId });
|
||||
},
|
||||
};
|
||||
|
||||
@@ -155,6 +155,7 @@ export async function createDiscordenoMessage(data: Message) {
|
||||
...props,
|
||||
/** The message id of the original message if this message was sent as a reply. If null, the original message was deleted. */
|
||||
channelId: createNewProp(channelId),
|
||||
content: createNewProp(data.content || ""),
|
||||
guildId: createNewProp(guildIdFinal),
|
||||
mentionedUserIds: createNewProp(mentions.map((m) => m.id)),
|
||||
mentionedRoleIds: createNewProp(mentionRoles),
|
||||
@@ -177,8 +178,12 @@ export async function createDiscordenoMessage(data: Message) {
|
||||
}
|
||||
|
||||
export interface DiscordenoMessage
|
||||
extends Omit<Message, "timestamp" | "editedTimestamp"> {
|
||||
extends Omit<Message, "timestamp" | "editedTimestamp" | "guildId"> {
|
||||
// For better user experience
|
||||
/** Id of the guild which the massage has been send in. Empty string if it a DM */
|
||||
guildId: string;
|
||||
/** The message content for this message. Empty string if no content was sent like an attachment only. */
|
||||
content: string;
|
||||
/** Ids of users specifically mentioned in the message */
|
||||
mentionedUserIds: string[];
|
||||
/** Ids of roles specifically mentioned in this message */
|
||||
@@ -245,10 +250,13 @@ export interface DiscordenoMessage
|
||||
timeout?: number,
|
||||
reason?: string,
|
||||
): Promise<unknown>;
|
||||
/** Remove all reactions */
|
||||
/** Removes all reactions for all emojis on this message */
|
||||
removeAllReactions(): ReturnType<typeof removeAllReactions>;
|
||||
/** Remove all reactions */
|
||||
/** Removes all reactions for a single emoji on this message */
|
||||
removeReactionEmoji(reaction: string): ReturnType<typeof removeReactionEmoji>;
|
||||
/** Remove all reactions */
|
||||
removeReaction(reaction: string): ReturnType<typeof removeReaction>;
|
||||
/** Removes a reaction from the given user on this message, defaults to bot */
|
||||
removeReaction(
|
||||
reaction: string,
|
||||
userId?: string,
|
||||
): ReturnType<typeof removeReaction>;
|
||||
}
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import { Integration } from "../integration/integration.ts";
|
||||
import { User } from "../users/user.ts";
|
||||
import { SnakeCasedPropertiesDeep } from "../util.ts";
|
||||
import { Webhook } from "../webhooks/webhook.ts";
|
||||
import { AuditLogEntry } from "./audit_log_entry.ts";
|
||||
|
||||
/** https://discord.com/developers/docs/resources/audit-log#audit-log-object */
|
||||
export interface AuditLog {
|
||||
/** List of webhooks found in the audit log */
|
||||
webhooks: Webhook[];
|
||||
@@ -14,6 +14,3 @@ export interface AuditLog {
|
||||
/** List of partial integration objects */
|
||||
integrations: Partial<Integration>[];
|
||||
}
|
||||
|
||||
/** https://discord.com/developers/docs/resources/audit-log#audit-log-object */
|
||||
export type DiscordAuditLog = SnakeCasedPropertiesDeep<AuditLog>;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { SnakeCasedPropertiesDeep } from "../util.ts";
|
||||
import { AuditLogChangeValue } from "./audit_log_change_value.ts";
|
||||
|
||||
/** https://discord.com/developers/docs/resources/audit-log#audit-log-change-object-audit-log-change-structure */
|
||||
export interface AuditLogChange {
|
||||
/** New value of the key */
|
||||
newValue?: AuditLogChangeValue;
|
||||
@@ -9,6 +9,3 @@ export interface AuditLogChange {
|
||||
/** Name of audit log change key */
|
||||
key: string;
|
||||
}
|
||||
|
||||
/** https://discord.com/developers/docs/resources/audit-log#audit-log-change-object-audit-log-change-structure */
|
||||
export type DiscordAuditLogChange = SnakeCasedPropertiesDeep<AuditLogChange>;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { Overwrite } from "../channels/overwrite.ts";
|
||||
import { Role } from "../permissions/role.ts";
|
||||
import { SnakeCasedPropertiesDeep } from "../util.ts";
|
||||
|
||||
/** https://discord.com/developers/docs/resources/audit-log#audit-log-change-object-audit-log-change-structure */
|
||||
export type AuditLogChangeValue =
|
||||
| {
|
||||
newValue: string;
|
||||
@@ -83,8 +83,3 @@ export type AuditLogChangeValue =
|
||||
oldValue: string | number;
|
||||
key: "type";
|
||||
};
|
||||
|
||||
/** https://discord.com/developers/docs/resources/audit-log#audit-log-change-object-audit-log-change-structure */
|
||||
export type DiscordAuditLogChangeValue = SnakeCasedPropertiesDeep<
|
||||
AuditLogChangeValue
|
||||
>;
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import { SnakeCasedPropertiesDeep } from "../util.ts";
|
||||
import { AuditLogChange } from "./audit_log_change.ts";
|
||||
import { DiscordAuditLogEvents } from "./audit_log_events.ts";
|
||||
import { OptionalAuditEntryInfo } from "./optional_audit_entry_info.ts";
|
||||
|
||||
/** https://discord.com/developers/docs/resources/audit-log#audit-log-entry-object-audit-log-entry-structure */
|
||||
export interface AuditLogEntry {
|
||||
/** id of the affected entity (webhook, user, role, etc.) */
|
||||
targetId: string | null;
|
||||
@@ -19,6 +19,3 @@ export interface AuditLogEntry {
|
||||
/** The reason for the change (0-512 characters) */
|
||||
reason?: string;
|
||||
}
|
||||
|
||||
/** https://discord.com/developers/docs/resources/audit-log#audit-log-entry-object-audit-log-entry-structure */
|
||||
export type DiscordAuditLogEntry = SnakeCasedPropertiesDeep<AuditLogEntry>;
|
||||
|
||||
@@ -36,3 +36,6 @@ export enum DiscordAuditLogEvents {
|
||||
INTEGRATION_UPDATE,
|
||||
INTEGRATION_DELETE,
|
||||
}
|
||||
|
||||
export type AuditLogEvents = DiscordAuditLogEvents;
|
||||
export const AuditLogEvents = DiscordAuditLogEvents;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { SnakeCasedPropertiesDeep } from "../util.ts";
|
||||
import { DiscordAuditLogEvents } from "./audit_log_events.ts";
|
||||
|
||||
/** https://discord.com/developers/docs/resources/audit-log#get-guild-audit-log-query-string-parameters */
|
||||
export interface GetGuildAuditLog {
|
||||
/** Filter the log for actions made by a user */
|
||||
userId: string;
|
||||
@@ -11,8 +11,3 @@ export interface GetGuildAuditLog {
|
||||
/** How many entries are returned (default 50, minimum 1, maximum 100) */
|
||||
limit: number;
|
||||
}
|
||||
|
||||
/** https://discord.com/developers/docs/resources/audit-log#get-guild-audit-log-query-string-parameters */
|
||||
export type DiscordGetGuildAuditLog = SnakeCasedPropertiesDeep<
|
||||
GetGuildAuditLog
|
||||
>;
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import { SnakeCasedPropertiesDeep } from "../util.ts";
|
||||
|
||||
/** https://discord.com/developers/docs/resources/audit-log#audit-log-entry-object-optional-audit-entry-info */
|
||||
export interface OptionalAuditEntryInfo {
|
||||
/** Number of days after which inactive members were kicked */
|
||||
deleteMemberDays: string;
|
||||
@@ -18,8 +17,3 @@ export interface OptionalAuditEntryInfo {
|
||||
/** Name of the role if type is "0" (not present if type is "1") */
|
||||
roleName: string;
|
||||
}
|
||||
|
||||
/** https://discord.com/developers/docs/resources/audit-log#audit-log-entry-object-optional-audit-entry-info */
|
||||
export type DiscordOptionalAuditEntryInfo = SnakeCasedPropertiesDeep<
|
||||
OptionalAuditEntryInfo
|
||||
>;
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import { User } from "../users/user.ts";
|
||||
import { SnakeCasedPropertiesDeep } from "../util.ts";
|
||||
import { DiscordChannelTypes } from "./channel_types.ts";
|
||||
import { DiscordOverwrite, Overwrite } from "./overwrite.ts";
|
||||
import { Overwrite } from "./overwrite.ts";
|
||||
import { DiscordVideoQualityModes } from "./video_quality_modes.ts";
|
||||
|
||||
/** https://discord.com/developers/docs/resources/channel#channel-object */
|
||||
export interface Channel {
|
||||
/** The id of the channel */
|
||||
id: string;
|
||||
@@ -46,9 +46,3 @@ export interface Channel {
|
||||
/** The camera video quality mode of the voice channel, 1 when not present */
|
||||
videoQualityMode?: DiscordVideoQualityModes;
|
||||
}
|
||||
|
||||
/** https://discord.com/developers/docs/resources/channel#channel-object */
|
||||
export interface DiscordChannel
|
||||
extends SnakeCasedPropertiesDeep<Omit<Channel, "permissionOverwrites">> {
|
||||
permission_overwrites?: DiscordOverwrite[];
|
||||
}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import { SnakeCasedPropertiesDeep } from "../util.ts";
|
||||
|
||||
/** https://discord.com/developers/docs/resources/channel#channel-mention-object */
|
||||
export interface ChannelMention {
|
||||
/** id of the channel */
|
||||
id: string;
|
||||
@@ -10,6 +9,3 @@ export interface ChannelMention {
|
||||
/** The name of the channel */
|
||||
name: string;
|
||||
}
|
||||
|
||||
/** https://discord.com/developers/docs/resources/channel#channel-mention-object */
|
||||
export type DiscordChannelMention = SnakeCasedPropertiesDeep<ChannelMention>;
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import { SnakeCasedPropertiesDeep } from "../util.ts";
|
||||
|
||||
/** https://discord.com/developers/docs/topics/gateway#channel-pins-update */
|
||||
export interface ChannelPinsUpdate {
|
||||
/** The id of the guild */
|
||||
guildId?: string;
|
||||
@@ -8,8 +7,3 @@ export interface ChannelPinsUpdate {
|
||||
/** The time at which the most recent pinned message was pinned */
|
||||
lastPinTimestamp?: string | null;
|
||||
}
|
||||
|
||||
/** https://discord.com/developers/docs/topics/gateway#channel-pins-update */
|
||||
export type DiscordChannelPinsUpdate = SnakeCasedPropertiesDeep<
|
||||
ChannelPinsUpdate
|
||||
>;
|
||||
|
||||
@@ -17,3 +17,6 @@ export enum DiscordChannelTypes {
|
||||
/** A voice channel for hosting events with an audience */
|
||||
GUILD_STAGE_VOICE = 13,
|
||||
}
|
||||
|
||||
export type ChannelTypes = DiscordChannelTypes;
|
||||
export const ChannelTypes = DiscordChannelTypes;
|
||||
|
||||
@@ -1,11 +1,7 @@
|
||||
import { SnakeCasedPropertiesDeep } from "../util.ts";
|
||||
|
||||
/** https://discord.com/developers/docs/resources/channel#followed-channel-object */
|
||||
export interface FollowedChannel {
|
||||
/** Source message id */
|
||||
channelId: string;
|
||||
/** Created target webhook id */
|
||||
webhookId: string;
|
||||
}
|
||||
|
||||
/** https://discord.com/developers/docs/resources/channel#followed-channel-object */
|
||||
export type DiscordFollowedChannel = SnakeCasedPropertiesDeep<FollowedChannel>;
|
||||
|
||||
@@ -37,3 +37,5 @@ export interface DiscordModifyChannel extends
|
||||
> {
|
||||
permission_overwrites?: DiscordOverwrite[];
|
||||
}
|
||||
|
||||
//TODO: check this
|
||||
|
||||
@@ -17,3 +17,5 @@ export interface DiscordOverwrite extends Omit<Overwrite, "allow" | "deny"> {
|
||||
allow: string;
|
||||
deny: string;
|
||||
}
|
||||
|
||||
// TODO: check this
|
||||
|
||||
@@ -2,3 +2,6 @@ export enum DiscordOverwriteTypes {
|
||||
ROLE,
|
||||
MEMBER,
|
||||
}
|
||||
|
||||
export type OverwriteTypes = DiscordOverwriteTypes;
|
||||
export const OverwriteTypes = DiscordOverwriteTypes;
|
||||
|
||||
@@ -4,3 +4,6 @@ export enum DiscordVideoQualityModes {
|
||||
/** 720p */
|
||||
Full,
|
||||
}
|
||||
|
||||
export type VideoQualityModes = DiscordVideoQualityModes;
|
||||
export const VideoQualityModes = DiscordVideoQualityModes;
|
||||
|
||||
@@ -15,3 +15,6 @@ export enum DiscordGatewayCloseEventCodes {
|
||||
InvalidIntents,
|
||||
DisallowedIntents,
|
||||
}
|
||||
|
||||
export type GatewayCloseEventCodes = DiscordGatewayCloseEventCodes;
|
||||
export const GatewayCloseEventCodes = DiscordGatewayCloseEventCodes;
|
||||
|
||||
@@ -12,3 +12,6 @@ export enum DiscordGatewayOpcodes {
|
||||
Hello,
|
||||
HeartbeatACK,
|
||||
}
|
||||
|
||||
export type GatewayOpcodes = DiscordGatewayOpcodes;
|
||||
export const GatewayOpcodes = DiscordGatewayOpcodes;
|
||||
|
||||
@@ -12,3 +12,6 @@ export enum DiscordHTTPResponseCodes {
|
||||
TooManyRequests = 429,
|
||||
GatewayUnavailable = 502,
|
||||
}
|
||||
|
||||
export type HTTPPResponseCodes = DiscordHTTPResponseCodes;
|
||||
export const HTTPPResponseCodes = DiscordHTTPResponseCodes;
|
||||
|
||||
@@ -43,6 +43,7 @@ export enum DiscordJsonErrorCodes {
|
||||
MaximumNumberOfInvitesReached,
|
||||
MaximumNumberOfGuildDiscoverySubcategoriesHasBeenReached = 30030,
|
||||
GuildAlreadyHasTemplate = 30031,
|
||||
MaximumNumberOfBansForNonGuildMembersHaveBeenExceeded = 30035,
|
||||
UnauthorizedProvideAValidTokenAndTryAgain = 40001,
|
||||
YouNeedToVerifyYourAccountInOrderToPerformThisAction,
|
||||
RequestEntityTooLargeTrySendingSomethingSmallerInSize = 40005,
|
||||
@@ -81,3 +82,6 @@ export enum DiscordJsonErrorCodes {
|
||||
ReqctionWasBlocked = 90001,
|
||||
ApiResourceIsCurrentlyOverloadedTryAgainALittleLater = 130000,
|
||||
}
|
||||
|
||||
export type JsonErrrorCodes = DiscordJsonErrorCodes;
|
||||
export const JsonErrrorCodes = DiscordJsonErrorCodes;
|
||||
|
||||
@@ -7,3 +7,6 @@ export enum DiscordRpcCloseEventCodes {
|
||||
InvalidVersion,
|
||||
InvalidEncoding,
|
||||
}
|
||||
|
||||
export type RpcCloseEventCodes = DiscordRpcCloseEventCodes;
|
||||
export const RpcCloseEventCodes = DiscordRpcCloseEventCodes;
|
||||
|
||||
@@ -17,3 +17,6 @@ export enum DiscordRpcErrorCodes {
|
||||
SelectVoiceForceRequired,
|
||||
CaptureShortcutAlreadyListening,
|
||||
}
|
||||
|
||||
export type RpcErrorCodes = DiscordRpcErrorCodes;
|
||||
export const RpcErrorCodes = DiscordRpcErrorCodes;
|
||||
|
||||
@@ -13,3 +13,6 @@ export enum DiscordVoiceCloseEventCodes {
|
||||
VoiceServerCrashed,
|
||||
UnknownEncryptionMode,
|
||||
}
|
||||
|
||||
export type VoiceCloseEventCodes = DiscordVoiceCloseEventCodes;
|
||||
export const VoiceCloseEventCodes = DiscordVoiceCloseEventCodes;
|
||||
|
||||
@@ -12,3 +12,6 @@ export enum DiscordVoiceOpcodes {
|
||||
Resumed,
|
||||
ClientDisconnect = 13,
|
||||
}
|
||||
|
||||
export type VoiceOpcodes = DiscordVoiceOpcodes;
|
||||
export const VoiceOpcodes = DiscordVoiceOpcodes;
|
||||
|
||||
@@ -161,8 +161,6 @@ export interface EventHandlers {
|
||||
) => unknown;
|
||||
/** Sent before every event execution. Discordeno will not await its execution. */
|
||||
raw?: (data: GatewayPayload) => unknown;
|
||||
// TODO: remove this?
|
||||
// rawGateway?: (data: unknown) => unknown;
|
||||
/** Sent when all shards went ready. */
|
||||
ready?: () => unknown;
|
||||
/** Sent when a user adds a reaction to a message. */
|
||||
|
||||
@@ -1,12 +1,6 @@
|
||||
import { SnakeCasedPropertiesDeep } from "../util.ts";
|
||||
|
||||
export interface AddGuildDiscoverySubcategory {
|
||||
/** The guild Id of the subcategory was added to */
|
||||
guildId: string;
|
||||
/** The Id of the subcategory added */
|
||||
categoryId: number;
|
||||
}
|
||||
|
||||
export type DiscordAddGuildDiscoverySubcategory = SnakeCasedPropertiesDeep<
|
||||
AddGuildDiscoverySubcategory
|
||||
>;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { SnakeCasedPropertiesDeep } from "../util.ts";
|
||||
import { DiscoveryName } from "./discovery_name.ts";
|
||||
|
||||
//TODO: add docs link
|
||||
export interface DiscoveryCategory {
|
||||
/** Numeric id of the category */
|
||||
id: number;
|
||||
@@ -9,8 +9,3 @@ export interface DiscoveryCategory {
|
||||
/** Whether this category can be set as a guild's primary category */
|
||||
isPrimary: boolean;
|
||||
}
|
||||
|
||||
//TODO: add docs link
|
||||
export type DiscordDiscoveryCategory = SnakeCasedPropertiesDeep<
|
||||
DiscoveryCategory
|
||||
>;
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import { SnakeCasedPropertiesDeep } from "../util.ts";
|
||||
|
||||
// TODO: add docs link
|
||||
export interface DiscoveryMetadata {
|
||||
/** The guild Id */
|
||||
guildId: string;
|
||||
@@ -16,8 +15,3 @@ export interface DiscoveryMetadata {
|
||||
/** Ids of up to 5 discovery subcategories set for this guild */
|
||||
categoryIds: number[];
|
||||
}
|
||||
|
||||
// TODO: add docs link
|
||||
export type DiscordDiscoveryMetadata = SnakeCasedPropertiesDeep<
|
||||
DiscoveryMetadata
|
||||
>;
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
//TODO: add docs link
|
||||
export interface DiscoveryName {
|
||||
/** The name in English */
|
||||
default: string;
|
||||
/** The name in other languages */
|
||||
localizations?: Record<string, string>;
|
||||
}
|
||||
|
||||
export type DiscordDiscoveryName = DiscoveryName;
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import { SnakeCasedPropertiesDeep } from "../util.ts";
|
||||
|
||||
// TODO: add docs link
|
||||
export interface ModifyGuildDiscoveryMetadata {
|
||||
/** The id of the primary discovery category. Default: 0 */
|
||||
primaryCategoryId?: number | null;
|
||||
@@ -8,7 +7,3 @@ export interface ModifyGuildDiscoveryMetadata {
|
||||
/** Whether guild info is shown when custom emojis are clicked. Default: true */
|
||||
emojiDiscoverabilityEnabled?: boolean | null;
|
||||
}
|
||||
|
||||
export type DiscordModifyGuildDiscoveryMetadata = SnakeCasedPropertiesDeep<
|
||||
ModifyGuildDiscoveryMetadata
|
||||
>;
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
// TODO: add docs link
|
||||
export interface ValidateDiscoverySearchTerm {
|
||||
/** Whether the provided term is valid */
|
||||
valid: boolean;
|
||||
}
|
||||
|
||||
export type DiscordValidateDiscoverySearchTerm = ValidateDiscoverySearchTerm;
|
||||
|
||||
@@ -1,8 +1,5 @@
|
||||
// TODO: add docs link
|
||||
export interface ValidateDiscoverySearchTermParams {
|
||||
/** The search term to check */
|
||||
term: string;
|
||||
}
|
||||
|
||||
// TODO: add docs link
|
||||
export type DiscordValidateDiscoverySearchTermParams =
|
||||
ValidateDiscoverySearchTermParams;
|
||||
|
||||
@@ -7,6 +7,7 @@ import { EmbedThumbnail } from "./embed_thumbnail.ts";
|
||||
import { DiscordEmbedTypes } from "./embed_types.ts";
|
||||
import { EmbedVideo } from "./embed_video.ts";
|
||||
|
||||
/** https://discord.com/developers/docs/resources/channel#embed-object */
|
||||
export interface Embed {
|
||||
/** Title of embed */
|
||||
title?: string;
|
||||
@@ -35,6 +36,3 @@ export interface Embed {
|
||||
/** Fields information */
|
||||
fields?: EmbedField[];
|
||||
}
|
||||
|
||||
/** https://discord.com/developers/docs/resources/channel#embed-object */
|
||||
export type DiscordEmbed = Embed;
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import { SnakeCasedPropertiesDeep } from "../util.ts";
|
||||
|
||||
/** https://discord.com/developers/docs/resources/channel#embed-object-embed-author-structure */
|
||||
export interface EmbedAuthor {
|
||||
/** Name of author */
|
||||
name?: string;
|
||||
@@ -10,6 +9,3 @@ export interface EmbedAuthor {
|
||||
/** A proxied url of author icon */
|
||||
proxyIconUrl?: string;
|
||||
}
|
||||
|
||||
/** https://discord.com/developers/docs/resources/channel#embed-object-embed-author-structure */
|
||||
export type DiscordEmbedAuthor = SnakeCasedPropertiesDeep<EmbedAuthor>;
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
/** https://discord.com/developers/docs/resources/channel#embed-object-embed-field-structure */
|
||||
export interface EmbedField {
|
||||
/** Name of the field */
|
||||
name: string;
|
||||
@@ -6,6 +7,3 @@ export interface EmbedField {
|
||||
/** Whether or not this field should display inline */
|
||||
inline?: boolean;
|
||||
}
|
||||
|
||||
/** https://discord.com/developers/docs/resources/channel#embed-object-embed-field-structure */
|
||||
export type DiscordEmbedField = EmbedField;
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import { SnakeCasedPropertiesDeep } from "../util.ts";
|
||||
|
||||
/** https://discord.com/developers/docs/resources/channel#embed-object-embed-footer-structure */
|
||||
export interface EmbedFooter {
|
||||
/** Footer text */
|
||||
text: string;
|
||||
@@ -8,6 +7,3 @@ export interface EmbedFooter {
|
||||
/** A proxied url of footer icon */
|
||||
proxyIconUrl?: string;
|
||||
}
|
||||
|
||||
/** https://discord.com/developers/docs/resources/channel#embed-object-embed-footer-structure */
|
||||
export type DiscordEmbedFooter = SnakeCasedPropertiesDeep<EmbedFooter>;
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import { SnakeCasedPropertiesDeep } from "../util.ts";
|
||||
|
||||
/** https://discord.com/developers/docs/resources/channel#embed-object-embed-image-structure */
|
||||
export interface EmbedImage {
|
||||
/** Source url of image (only supports http(s) and attachments) */
|
||||
url?: string;
|
||||
@@ -10,6 +9,3 @@ export interface EmbedImage {
|
||||
/** Width of image */
|
||||
width?: number;
|
||||
}
|
||||
|
||||
/** https://discord.com/developers/docs/resources/channel#embed-object-embed-image-structure */
|
||||
export type DiscordEmbedImage = SnakeCasedPropertiesDeep<EmbedImage>;
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
export type DiscordEmbedProvider = EmbedProvider;
|
||||
export interface EmbedProvider {
|
||||
/** Name of provider */
|
||||
name?: string;
|
||||
/** Url of provider */
|
||||
url?: string;
|
||||
}
|
||||
|
||||
/** https://discord.com/developers/docs/resources/channel#embed-object-embed-provider-structure */
|
||||
export type DiscordEmbedProvider = EmbedProvider;
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import { SnakeCasedPropertiesDeep } from "../util.ts";
|
||||
|
||||
/** https://discord.com/developers/docs/resources/channel#embed-object-embed-thumbnail-structure */
|
||||
export interface EmbedThumbnail {
|
||||
/** Source url of thumbnail (only supports http(s) and attachments) */
|
||||
url?: string;
|
||||
@@ -10,6 +9,3 @@ export interface EmbedThumbnail {
|
||||
/** Width of thumbnail */
|
||||
width?: number;
|
||||
}
|
||||
|
||||
/** https://discord.com/developers/docs/resources/channel#embed-object-embed-thumbnail-structure */
|
||||
export type DiscordEmbedThumbnail = SnakeCasedPropertiesDeep<EmbedThumbnail>;
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import { SnakeCasedPropertiesDeep } from "../util.ts";
|
||||
|
||||
/** https://discord.com/developers/docs/resources/channel#embed-object-embed-video-structure */
|
||||
export interface EmbedVideo {
|
||||
/** Source url of video */
|
||||
url?: string;
|
||||
@@ -10,6 +9,3 @@ export interface EmbedVideo {
|
||||
/** Width of video */
|
||||
width?: number;
|
||||
}
|
||||
|
||||
/** https://discord.com/developers/docs/resources/channel#embed-object-embed-video-structure */
|
||||
export type DiscordEmbedVideo = SnakeCasedPropertiesDeep<EmbedVideo>;
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
/** https://discord.com/developers/docs/resources/emoji#create-guild-emoji */
|
||||
export interface CreateGuildEmoji {
|
||||
/** Name of the emoji */
|
||||
name: string;
|
||||
@@ -6,6 +7,3 @@ export interface CreateGuildEmoji {
|
||||
/** Roles allowed to use this emoji */
|
||||
roles: string[];
|
||||
}
|
||||
|
||||
/** https://discord.com/developers/docs/resources/emoji#create-guild-emoji */
|
||||
export type DiscordCreateGuildEmojis = CreateGuildEmoji;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { User } from "../users/user.ts";
|
||||
import { SnakeCasedPropertiesDeep } from "../util.ts";
|
||||
|
||||
/** https://discord.com/developers/docs/resources/emoji#emoji-object-emoji-structure */
|
||||
export interface Emoji {
|
||||
/** Emoji id */
|
||||
id: string | null;
|
||||
@@ -19,6 +19,3 @@ export interface Emoji {
|
||||
/** Whether this emoji can be used, may be false due to loss of Server Boosts */
|
||||
available?: boolean;
|
||||
}
|
||||
|
||||
/** https://discord.com/developers/docs/resources/emoji#emoji-object-emoji-structure */
|
||||
export type DiscordEmoji = SnakeCasedPropertiesDeep<Emoji>;
|
||||
|
||||
@@ -1,14 +1,9 @@
|
||||
import { Emoji } from "../emojis/emoji.ts";
|
||||
import { SnakeCasedPropertiesDeep } from "../util.ts";
|
||||
|
||||
/** https://discord.com/developers/docs/topics/gateway#guild-emojis-update */
|
||||
export interface GuildEmojisUpdate {
|
||||
/** id of the guild */
|
||||
guildId: string;
|
||||
/** Array of emojis */
|
||||
emojis: Emoji[];
|
||||
}
|
||||
|
||||
/** https://discord.com/developers/docs/topics/gateway#guild-emojis-update */
|
||||
export type DiscordGuildEmojisUpdate = SnakeCasedPropertiesDeep<
|
||||
GuildEmojisUpdate
|
||||
>;
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
/** https://discord.com/developers/docs/resources/emoji#modify-guild-emoji */
|
||||
export interface ModifyGuildEmoji {
|
||||
/** Name of the emoji */
|
||||
name?: string;
|
||||
/** Roles allowed to use this emoji */
|
||||
roles?: string[] | null;
|
||||
}
|
||||
|
||||
/** https://discord.com/developers/docs/resources/emoji#modify-guild-emoji */
|
||||
export type DiscordModifyGuildEmoji = ModifyGuildEmoji;
|
||||
|
||||
@@ -88,3 +88,6 @@ export enum DiscordGatewayIntents {
|
||||
*/
|
||||
DIRECT_MESSAGE_TYPING = 1 << 14,
|
||||
}
|
||||
|
||||
export type Intents = DiscordGatewayIntents;
|
||||
export const Intents = DiscordGatewayIntents;
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
/** https://discord.com/developers/docs/topics/gateway#connecting-gateway-url-params */
|
||||
export interface GatewayURLParams {
|
||||
/** Gateway version to use */
|
||||
v: string;
|
||||
@@ -6,6 +7,3 @@ export interface GatewayURLParams {
|
||||
/** The (optional) compression of gateway packets */
|
||||
compress?: string;
|
||||
}
|
||||
|
||||
/** https://discord.com/developers/docs/topics/gateway#connecting-gateway-url-params */
|
||||
export type DiscordGatewayURLParams = GatewayURLParams;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { SnakeCasedPropertiesDeep } from "../util.ts";
|
||||
import { SessionStartLimit } from "./session_start_limit.ts";
|
||||
|
||||
/** https://discord.com/developers/docs/topics/gateway#get-gateway-bot */
|
||||
export interface GetGatewayBot {
|
||||
/** The WSS URL that can be used for connecting to the gateway */
|
||||
url: string;
|
||||
@@ -9,6 +9,3 @@ export interface GetGatewayBot {
|
||||
/** Information on the current session start limit */
|
||||
sessionStartLimit: SessionStartLimit;
|
||||
}
|
||||
|
||||
/** https://discord.com/developers/docs/topics/gateway#get-gateway-bot */
|
||||
export type DiscordGetGatewayBot = SnakeCasedPropertiesDeep<GetGatewayBot>;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { SnakeCasedPropertiesDeep } from "../util.ts";
|
||||
import { IdentifyConnectionProperties } from "./identify_connection_properties.ts";
|
||||
import { StatusUpdate } from "./status_update.ts";
|
||||
|
||||
/** https://discord.com/developers/docs/topics/gateway#identify */
|
||||
export interface Identify {
|
||||
/** Authentication token */
|
||||
token: string;
|
||||
@@ -18,6 +18,3 @@ export interface Identify {
|
||||
/** The Gateway Intents you wish to receive */
|
||||
intents: number;
|
||||
}
|
||||
|
||||
/** https://discord.com/developers/docs/topics/gateway#identify */
|
||||
export type DiscordIdentify = SnakeCasedPropertiesDeep<Identify>;
|
||||
|
||||
@@ -3,6 +3,7 @@ import { Application } from "../oauth2/application.ts";
|
||||
import { User } from "../users/user.ts";
|
||||
import { SnakeCasedPropertiesDeep } from "../util.ts";
|
||||
|
||||
/** https://discord.com/developers/docs/topics/gateway#ready */
|
||||
export interface Ready {
|
||||
/** Gateway version */
|
||||
v: number;
|
||||
@@ -20,5 +21,4 @@ export interface Ready {
|
||||
application: Partial<Application> & Pick<Application, "id" | "flags">;
|
||||
}
|
||||
|
||||
/** https://discord.com/developers/docs/topics/gateway#ready */
|
||||
export type DiscordReady = SnakeCasedPropertiesDeep<Ready>;
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
/** https://discord.com/developers/docs/topics/gateway#resume */
|
||||
export interface Resume {
|
||||
/** Session token */
|
||||
token: string;
|
||||
@@ -6,6 +7,3 @@ export interface Resume {
|
||||
/** Last sequence number received */
|
||||
seq: number;
|
||||
}
|
||||
|
||||
/** https://discord.com/developers/docs/topics/gateway#resume */
|
||||
export type DiscordResume = Resume;
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import { SnakeCasedPropertiesDeep } from "../util.ts";
|
||||
|
||||
/** https://discord.com/developers/docs/topics/gateway#session-start-limit-object */
|
||||
export interface SessionStartLimit {
|
||||
/** The total number of session starts the current user is allowed */
|
||||
total: number;
|
||||
@@ -10,8 +9,3 @@ export interface SessionStartLimit {
|
||||
/** The number of identify requests allowed per 5 seconds */
|
||||
maxConcurrency: number;
|
||||
}
|
||||
|
||||
/** https://discord.com/developers/docs/topics/gateway#session-start-limit-object */
|
||||
export type DiscordSessionStartLimit = SnakeCasedPropertiesDeep<
|
||||
SessionStartLimit
|
||||
>;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { Activity } from "../misc/activity.ts";
|
||||
import { SnakeCasedPropertiesDeep } from "../util.ts";
|
||||
import { DiscordStatusTypes } from "./status_types.ts";
|
||||
|
||||
/** https://discord.com/developers/docs/topics/gateway#update-status */
|
||||
export interface StatusUpdate {
|
||||
/** Unix time (in milliseconds) of when the client went idle, or null if the client is not idle */
|
||||
since: number | null;
|
||||
@@ -12,6 +12,3 @@ export interface StatusUpdate {
|
||||
/** Whether or not the client is afk */
|
||||
afk: boolean;
|
||||
}
|
||||
|
||||
/** https://discord.com/developers/docs/topics/gateway#update-status */
|
||||
export type DiscordStatusUpdate = SnakeCasedPropertiesDeep<StatusUpdate>;
|
||||
|
||||
@@ -1,12 +1,9 @@
|
||||
import { User } from "../users/user.ts";
|
||||
import { SnakeCasedPropertiesDeep } from "../util.ts";
|
||||
|
||||
/** https://discord.com/developers/docs/resources/guild#ban-object */
|
||||
export interface Ban {
|
||||
/** The reason for the ban */
|
||||
reason: string | null;
|
||||
/** The banned user */
|
||||
user: User;
|
||||
}
|
||||
|
||||
/** https://discord.com/developers/docs/resources/guild#ban-object */
|
||||
export type DiscordBan = SnakeCasedPropertiesDeep<Ban>;
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import { SnakeCasedPropertiesDeep } from "../util.ts";
|
||||
|
||||
/** https://discord.com/developers/docs/resources/guild#begin-guild-prune */
|
||||
export interface BeginGuildPrune {
|
||||
/** Number of days to prune (1 or more), default: 7 */
|
||||
days?: number;
|
||||
@@ -8,6 +7,3 @@ export interface BeginGuildPrune {
|
||||
/** Role(s) ro include, default: none */
|
||||
includeRoles?: string[];
|
||||
}
|
||||
|
||||
/** https://discord.com/developers/docs/resources/guild#begin-guild-prune */
|
||||
export type DiscordBeginGuildPrune = SnakeCasedPropertiesDeep<BeginGuildPrune>;
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
import { Channel } from "../channels/channel.ts";
|
||||
import { Role } from "../permissions/role.ts";
|
||||
import { SnakeCasedPropertiesDeep } from "../util.ts";
|
||||
import { DiscordDefaultMessageNotificationLevels } from "./default_message_notification_levels.ts";
|
||||
import { DiscordExplicitContentFilterLevels } from "./explicit_content_filter_levels.ts";
|
||||
import { DiscordSystemChannelFlags } from "./system_channel_flags.ts";
|
||||
import { DiscordVerificationLevels } from "./verification_levels.ts";
|
||||
|
||||
/** https://discord.com/developers/docs/resources/guild#create-guild */
|
||||
export interface CreateGuild {
|
||||
/** Name of the guild (2-100 characters) */
|
||||
name: string;
|
||||
@@ -32,6 +32,3 @@ export interface CreateGuild {
|
||||
/** System channel flags */
|
||||
systemChannelFlags?: DiscordSystemChannelFlags;
|
||||
}
|
||||
|
||||
/** https://discord.com/developers/docs/resources/guild#create-guild */
|
||||
export type DiscordCreateGuild = SnakeCasedPropertiesDeep<CreateGuild>;
|
||||
|
||||
@@ -1,11 +1,7 @@
|
||||
import { SnakeCasedPropertiesDeep } from "../util.ts";
|
||||
|
||||
/** https://discord.com/developers/docs/resources/guild#create-guild-ban */
|
||||
export interface CreateGuildBan {
|
||||
/** Number of days to delete messages for (0-7) */
|
||||
deleteMessageDays?: 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7;
|
||||
/** Reason for the ban */
|
||||
reason?: string;
|
||||
}
|
||||
|
||||
/** https://discord.com/developers/docs/resources/guild#create-guild-ban */
|
||||
export type DiscordCreateGuildBan = SnakeCasedPropertiesDeep<CreateGuildBan>;
|
||||
|
||||
@@ -32,3 +32,4 @@ export interface DiscordCreateGuildChannel extends
|
||||
> {
|
||||
permission_overwrites: DiscordOverwrite[];
|
||||
}
|
||||
// TODO: check this
|
||||
|
||||
@@ -18,3 +18,4 @@ export interface DiscordCreateGuildRole
|
||||
extends Omit<CreateGuildRole, "permissions"> {
|
||||
permissions?: string;
|
||||
}
|
||||
// TODO: check this
|
||||
|
||||
@@ -5,3 +5,8 @@ export enum DiscordDefaultMessageNotificationLevels {
|
||||
/** Members will receive notifications only for messages that @mention them by default */
|
||||
ONLY_MENTIONS,
|
||||
}
|
||||
|
||||
export type DefaultMessageNotificationLevels =
|
||||
DiscordDefaultMessageNotificationLevels;
|
||||
export const DefaultMessageNotificationLevels =
|
||||
DiscordDefaultMessageNotificationLevels;
|
||||
|
||||
@@ -7,3 +7,6 @@ export enum DiscordExplicitContentFilterLevels {
|
||||
/** Media content sent by all members will be scanned */
|
||||
ALL_MEMBERS,
|
||||
}
|
||||
|
||||
export type ExplicitContentFilterLevels = DiscordExplicitContentFilterLevels;
|
||||
export const ExplicitContentFilterLevels = DiscordExplicitContentFilterLevels;
|
||||
|
||||
@@ -1,9 +1,5 @@
|
||||
import { SnakeCasedPropertiesDeep } from "../util.ts";
|
||||
|
||||
/** https://discord.com/developers/docs/resources/guild#get-guild */
|
||||
export interface GetGuildQuery {
|
||||
/** When true, will return approximate member and presence counts for the guild */
|
||||
withCounts?: boolean;
|
||||
}
|
||||
|
||||
/** https://discord.com/developers/docs/resources/guild#get-guild */
|
||||
export type DiscordGetGuildQuery = SnakeCasedPropertiesDeep<GetGuildQuery>;
|
||||
|
||||
@@ -1,13 +1,7 @@
|
||||
import { SnakeCasedPropertiesDeep } from "../util.ts";
|
||||
|
||||
/** https://discord.com/developers/docs/resources/guild#get-guild-prune-count */
|
||||
export interface GetGuildPruneCountQuery {
|
||||
/** Number of days to count prune for (1 or more), default: 7 */
|
||||
days?: number;
|
||||
/** Role(s) to include, default: none */
|
||||
includeRoles: string | string[];
|
||||
}
|
||||
|
||||
/** https://discord.com/developers/docs/resources/guild#get-guild-prune-count */
|
||||
export type DiscordGetGuildPruneCountQuery = SnakeCasedPropertiesDeep<
|
||||
GetGuildPruneCountQuery
|
||||
>;
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
import { DiscordGetGuildWidgetImageStyleOptions } from "./get_guild_widget_image_style_options.ts";
|
||||
|
||||
/** https://discord.com/developers/docs/resources/guild#get-guild-widget-image-query-string-params */
|
||||
export interface GetGuildWidgetImageQuery {
|
||||
/** Style of the widget returned, default: shield */
|
||||
style?: DiscordGetGuildWidgetImageStyleOptions;
|
||||
}
|
||||
|
||||
/** https://discord.com/developers/docs/resources/guild#get-guild-widget-image-query-string-params */
|
||||
export type DiscordGetGuildWidgetImage = GetGuildWidgetImageQuery;
|
||||
|
||||
@@ -11,3 +11,8 @@ export enum DiscordGetGuildWidgetImageStyleOptions {
|
||||
/** Large Discord logo at the top of the widget. Guild icon, name and online count in the middle portion of the widget and a "JOIN MY SERVER" button at the bottom */
|
||||
BANNER_4 = "banner4",
|
||||
}
|
||||
|
||||
export type GetGuildWidgetImageStyleOptions =
|
||||
DiscordGetGuildWidgetImageStyleOptions;
|
||||
export const GetGuildWidgetImageStyleOptions =
|
||||
DiscordGetGuildWidgetImageStyleOptions;
|
||||
|
||||
@@ -2,7 +2,6 @@ import { Channel } from "../channels/channel.ts";
|
||||
import { Emoji } from "../emojis/emoji.ts";
|
||||
import { PresenceUpdate } from "../misc/presence_update.ts";
|
||||
import { Role } from "../permissions/role.ts";
|
||||
import { SnakeCasedPropertiesDeep } from "../util.ts";
|
||||
import { VoiceState } from "../voice/voice_state.ts";
|
||||
import { DiscordDefaultMessageNotificationLevels } from "./default_message_notification_levels.ts";
|
||||
import { DiscordExplicitContentFilterLevels } from "./explicit_content_filter_levels.ts";
|
||||
@@ -14,6 +13,7 @@ import { DiscordSystemChannelFlags } from "./system_channel_flags.ts";
|
||||
import { DiscordVerificationLevels } from "./verification_levels.ts";
|
||||
import { WelcomeScreen } from "./welcome_screen.ts";
|
||||
|
||||
/** https://discord.com/developers/docs/resources/guild#guild-object */
|
||||
export interface Guild {
|
||||
/** Guild id */
|
||||
id: string;
|
||||
@@ -107,7 +107,6 @@ export interface Guild {
|
||||
approximatePresenceCount?: number;
|
||||
/** The welcome screen of a Community guild, shown to new members, returned when in the invite object */
|
||||
welcomeScreen?: WelcomeScreen;
|
||||
/** `true` if this guild is designated as NSFW */
|
||||
nsfw: boolean;
|
||||
}
|
||||
|
||||
/** https://discord.com/developers/docs/resources/guild#guild-object */
|
||||
export type DiscordGuild = SnakeCasedPropertiesDeep<Guild>;
|
||||
|
||||
@@ -1,14 +1,9 @@
|
||||
import { User } from "../users/user.ts";
|
||||
import { SnakeCasedPropertiesDeep } from "../util.ts";
|
||||
|
||||
/** https://discord.com/developers/docs/topics/gateway#guild-ban-add */
|
||||
export interface GuildBanAddRemove {
|
||||
/** id of the guild */
|
||||
guildId: string;
|
||||
/** The banned user */
|
||||
user: User;
|
||||
}
|
||||
|
||||
/** https://discord.com/developers/docs/topics/gateway#guild-ban-add */
|
||||
export type DiscordGuildBanAddRemove = SnakeCasedPropertiesDeep<
|
||||
GuildBanAddRemove
|
||||
>;
|
||||
|
||||
@@ -1,12 +1,9 @@
|
||||
import { User } from "../users/user.ts";
|
||||
import { SnakeCasedPropertiesDeep } from "../util.ts";
|
||||
|
||||
/** https://discord.com/developers/docs/topics/gateway#guild-ban-remove */
|
||||
export interface GuildBanRemove {
|
||||
/** id of the guild */
|
||||
guildId: string;
|
||||
/** The unbanned user */
|
||||
user: User;
|
||||
}
|
||||
|
||||
/** https://discord.com/developers/docs/topics/gateway#guild-ban-remove */
|
||||
export type DiscordGuildBanRemove = SnakeCasedPropertiesDeep<GuildBanRemove>;
|
||||
|
||||
@@ -17,7 +17,8 @@ export enum DiscordGuildFeatures {
|
||||
/** Guild has access to create news channels */
|
||||
NEWS = "NEWS",
|
||||
/** Guild is able to be discovered in the directory */
|
||||
DISCOVERABLE = "DISCOVERABLE", /** guild cannot be discoverable */
|
||||
DISCOVERABLE = "DISCOVERABLE",
|
||||
/** guild cannot be discoverable */
|
||||
DISCOVERABLE_DISABLED = "DISCOVERABLE_DISABLED",
|
||||
/** Guild is able to be featured in the directory */
|
||||
FEATURABLE = "FEATURABLE",
|
||||
@@ -32,3 +33,6 @@ export enum DiscordGuildFeatures {
|
||||
/** Guild can be previewed before joining via Membership Screening or the directory */
|
||||
PREVIEW_ENABLED = "PREVIEW_ENABLED",
|
||||
}
|
||||
|
||||
export type GuildFeatures = DiscordGuildFeatures;
|
||||
export const GuildFeatures = DiscordGuildFeatures;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { User } from "../users/user.ts";
|
||||
import { SnakeCasedPropertiesDeep } from "../util.ts";
|
||||
|
||||
/** https://discord.com/developers/docs/resources/guild#guild-member-object */
|
||||
export interface GuildMember {
|
||||
/** The user this guild member represents */
|
||||
user?: User;
|
||||
@@ -20,13 +20,7 @@ export interface GuildMember {
|
||||
pending?: boolean;
|
||||
}
|
||||
|
||||
/** https://discord.com/developers/docs/resources/guild#guild-member-object */
|
||||
export type DiscordGuildMember = SnakeCasedPropertiesDeep<GuildMember>;
|
||||
|
||||
// We use these types much since user always exists unless its a `CREATE_MESSAGE` or `MESSAGE_UPDATE` event
|
||||
|
||||
export type GuildMemberWithUser = Omit<GuildMember, "user"> & { user: User };
|
||||
/** https://discord.com/developers/docs/resources/guild#guild-member-object */
|
||||
export type DiscordGuildMemberWithUser = SnakeCasedPropertiesDeep<
|
||||
GuildMemberWithUser
|
||||
>;
|
||||
export type GuildMemberWithUser = Omit<GuildMember, "user"> & { user: User };
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { Emoji } from "../emojis/emoji.ts";
|
||||
import { SnakeCasedPropertiesDeep } from "../util.ts";
|
||||
import { DiscordGuildFeatures } from "./guild_features.ts";
|
||||
|
||||
/** https://discord.com/developers/docs/resources/guild#guild-preview-object */
|
||||
export interface GuildPreview {
|
||||
/** Guild id */
|
||||
id: string;
|
||||
@@ -24,6 +24,3 @@ export interface GuildPreview {
|
||||
/** The description for the guild, if the guild is discoverable */
|
||||
description: string | null;
|
||||
}
|
||||
|
||||
/** https://discord.com/developers/docs/resources/guild#guild-preview-object */
|
||||
export type DiscordGuildPreview = SnakeCasedPropertiesDeep<GuildPreview>;
|
||||
|
||||
@@ -1,12 +1,9 @@
|
||||
import { Role } from "../permissions/role.ts";
|
||||
import { SnakeCasedPropertiesDeep } from "../util.ts";
|
||||
|
||||
/** https://discord.com/developers/docs/topics/gateway#guild-role-create */
|
||||
export interface GuildRoleCreate {
|
||||
/** The id of the guild */
|
||||
guildId: string;
|
||||
/** The role created */
|
||||
role: Role;
|
||||
}
|
||||
|
||||
/** https://discord.com/developers/docs/topics/gateway#guild-role-create */
|
||||
export type DiscordGuildRoleCreate = SnakeCasedPropertiesDeep<GuildRoleCreate>;
|
||||
|
||||
@@ -1,11 +1,7 @@
|
||||
import { SnakeCasedPropertiesDeep } from "../util.ts";
|
||||
|
||||
/** https://discord.com/developers/docs/topics/gateway#guild-role-delete */
|
||||
export interface GuildRoleDelete {
|
||||
/** id of the guild */
|
||||
guildId: string;
|
||||
/** id of the role */
|
||||
roleId: string;
|
||||
}
|
||||
|
||||
/** https://discord.com/developers/docs/topics/gateway#guild-role-delete */
|
||||
export type DiscordGuildRoleDelete = SnakeCasedPropertiesDeep<GuildRoleDelete>;
|
||||
|
||||
@@ -1,12 +1,9 @@
|
||||
import { Role } from "../permissions/role.ts";
|
||||
import { SnakeCasedPropertiesDeep } from "../util.ts";
|
||||
|
||||
/** https://discord.com/developers/docs/topics/gateway#guild-role-update */
|
||||
export interface GuildRoleUpdate {
|
||||
/** The id of the guild */
|
||||
guildId: string;
|
||||
/** The role updated */
|
||||
role: Role;
|
||||
}
|
||||
|
||||
/** https://discord.com/developers/docs/topics/gateway#guild-role-update */
|
||||
export type DiscordGuildRoleUpdate = SnakeCasedPropertiesDeep<GuildRoleUpdate>;
|
||||
|
||||
@@ -1,11 +1,7 @@
|
||||
import { SnakeCasedPropertiesDeep } from "../util.ts";
|
||||
|
||||
/** https://discord.com/developers/docs/resources/guild#guild-widget-object-guild-widget-structure */
|
||||
export interface GuildWidget {
|
||||
/** Whether the widget is enabled */
|
||||
enabled: boolean;
|
||||
/** The widget channel id */
|
||||
channelId: string | null;
|
||||
}
|
||||
|
||||
/** https://discord.com/developers/docs/resources/guild#guild-widget-object-guild-widget-structure */
|
||||
export type DiscordGuildWidget = SnakeCasedPropertiesDeep<GuildWidget>;
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
/** https://discord.com/developers/docs/resources/guild#list-guild-members */
|
||||
export interface ListGuildMembers {
|
||||
/** Max number of members to return (1-1000). Default: 1 */
|
||||
limit?: number;
|
||||
/** The highest user id in the previous page. Default: 0 */
|
||||
after?: string;
|
||||
}
|
||||
|
||||
/** https://discord.com/developers/docs/resources/guild#list-guild-members */
|
||||
export type DiscordListGuildMembers = ListGuildMembers;
|
||||
|
||||
@@ -5,3 +5,6 @@ export enum DiscordMfaLevels {
|
||||
/** Guild has a 2FA requirement for moderation actions */
|
||||
ELEVATED,
|
||||
}
|
||||
|
||||
export type MfaLevels = DiscordMfaLevels;
|
||||
export const MfaLevels = DiscordMfaLevels;
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user