Merge branch 'main' into threads

This commit is contained in:
ITOH
2021-05-04 17:45:38 +02:00
168 changed files with 485 additions and 371 deletions

View File

@@ -1,7 +1,7 @@
# Contributing
- Read the [style guide](#style-guide).
- Ask for help on the [official Discord server](https:)
- Ask for help on the [official Discord server](https://discord.gg/5vBgXk3UcZ)
- If you are going to work on an issue, mention so in the issue comments before
you start working on the issue.
- If you are going to work on a new feature, create an issue and discuss with
@@ -38,10 +38,9 @@
## Types Guide
- Must use snake case (according to Discord API).
- Must use camel case (same property name as in the docs just in camel case).
- Each field or property must be accompanied with a reasonable JSDoc comment
right above its type definition.
- The name of the type must be prefixed with `Discord`.
- Must be placed inside of the types module (in `src/types` directory).
Example:
@@ -61,6 +60,4 @@ export interface User {
flags?: number;
premiumType?: number;
}
export type DiscordUser = SnakeCasedPropertiesDeep<DiscordUserInternal>;
```

View File

@@ -1,6 +1,6 @@
import { getGatewayBot } from "./helpers/misc/get_gateway_bot.ts";
import { rest } from "./rest/rest.ts";
import { EventHandlers } from "./types/discordeno/eventHandlers.ts";
import type { EventHandlers } from "./types/discordeno/eventHandlers.ts";
import { DiscordGatewayIntents } from "./types/gateway/gateway_intents.ts";
import { snowflakeToBigint } from "./util/bigint.ts";
import { baseEndpoints, GATEWAY_VERSION } from "./util/constants.ts";

View File

@@ -1,10 +1,10 @@
// deno-lint-ignore-file require-await no-explicit-any prefer-const
import { DiscordenoChannel } from "./structures/channel.ts";
import { DiscordenoGuild } from "./structures/guild.ts";
import { DiscordenoMember } from "./structures/member.ts";
import { DiscordenoMessage } from "./structures/message.ts";
import { Emoji } from "./types/emojis/emoji.ts";
import { PresenceUpdate } from "./types/misc/presence_update.ts";
import type { DiscordenoChannel } from "./structures/channel.ts";
import type { DiscordenoGuild } from "./structures/guild.ts";
import type { DiscordenoMember } from "./structures/member.ts";
import type { DiscordenoMessage } from "./structures/message.ts";
import type { Emoji } from "./types/emojis/emoji.ts";
import type { PresenceUpdate } from "./types/misc/presence_update.ts";
import { Collection } from "./util/collection.ts";
export const cache = {

View File

@@ -1,8 +1,8 @@
import { eventHandlers } from "../../bot.ts";
import { cacheHandlers } from "../../cache.ts";
import { structures } from "../../structures/mod.ts";
import { Channel } from "../../types/channels/channel.ts";
import { DiscordGatewayPayload } from "../../types/gateway/gateway_payload.ts";
import type { Channel } from "../../types/channels/channel.ts";
import type { DiscordGatewayPayload } from "../../types/gateway/gateway_payload.ts";
export async function handleChannelCreate(data: DiscordGatewayPayload) {
const payload = data.d as Channel;

View File

@@ -1,8 +1,8 @@
import { eventHandlers } from "../../bot.ts";
import { cacheHandlers } from "../../cache.ts";
import { Channel } from "../../types/channels/channel.ts";
import type { Channel } from "../../types/channels/channel.ts";
import { DiscordChannelTypes } from "../../types/channels/channel_types.ts";
import { DiscordGatewayPayload } from "../../types/gateway/gateway_payload.ts";
import type { DiscordGatewayPayload } from "../../types/gateway/gateway_payload.ts";
import { snowflakeToBigint } from "../../util/bigint.ts";
export async function handleChannelDelete(data: DiscordGatewayPayload) {

View File

@@ -1,7 +1,7 @@
import { eventHandlers } from "../../bot.ts";
import { cacheHandlers } from "../../cache.ts";
import { ChannelPinsUpdate } from "../../types/channels/channel_pins_update.ts";
import { DiscordGatewayPayload } from "../../types/gateway/gateway_payload.ts";
import type { ChannelPinsUpdate } from "../../types/channels/channel_pins_update.ts";
import type { DiscordGatewayPayload } from "../../types/gateway/gateway_payload.ts";
import { snowflakeToBigint } from "../../util/bigint.ts";
export async function handleChannelPinsUpdate(data: DiscordGatewayPayload) {

View File

@@ -1,8 +1,8 @@
import { eventHandlers } from "../../bot.ts";
import { cacheHandlers } from "../../cache.ts";
import { structures } from "../../structures/mod.ts";
import { Channel } from "../../types/channels/channel.ts";
import { DiscordGatewayPayload } from "../../types/gateway/gateway_payload.ts";
import type { Channel } from "../../types/channels/channel.ts";
import type { DiscordGatewayPayload } from "../../types/gateway/gateway_payload.ts";
import { snowflakeToBigint } from "../../util/bigint.ts";
export async function handleChannelUpdate(data: DiscordGatewayPayload) {

View File

@@ -1,6 +1,6 @@
import { eventHandlers } from "../../bot.ts";
import { DiscordGatewayPayload } from "../../types/gateway/gateway_payload.ts";
import {
import type { DiscordGatewayPayload } from "../../types/gateway/gateway_payload.ts";
import type {
ApplicationCommandCreateUpdateDelete,
} from "../../types/interactions/application_command_create_update_delete.ts";

View File

@@ -1,6 +1,6 @@
import { eventHandlers } from "../../bot.ts";
import { DiscordGatewayPayload } from "../../types/gateway/gateway_payload.ts";
import {
import type { DiscordGatewayPayload } from "../../types/gateway/gateway_payload.ts";
import type {
ApplicationCommandCreateUpdateDelete,
} from "../../types/interactions/application_command_create_update_delete.ts";

View File

@@ -1,6 +1,6 @@
import { eventHandlers } from "../../bot.ts";
import { DiscordGatewayPayload } from "../../types/gateway/gateway_payload.ts";
import {
import type { DiscordGatewayPayload } from "../../types/gateway/gateway_payload.ts";
import type {
ApplicationCommandCreateUpdateDelete,
} from "../../types/interactions/application_command_create_update_delete.ts";

View File

@@ -1,7 +1,7 @@
import { eventHandlers } from "../../bot.ts";
import { cacheHandlers } from "../../cache.ts";
import { GuildEmojisUpdate } from "../../types/emojis/guild_emojis_update.ts";
import { DiscordGatewayPayload } from "../../types/gateway/gateway_payload.ts";
import type { GuildEmojisUpdate } from "../../types/emojis/guild_emojis_update.ts";
import type { DiscordGatewayPayload } from "../../types/gateway/gateway_payload.ts";
import { snowflakeToBigint } from "../../util/bigint.ts";
import { Collection } from "../../util/collection.ts";

View File

@@ -1,7 +1,7 @@
import { eventHandlers } from "../../bot.ts";
import { cacheHandlers } from "../../cache.ts";
import { DiscordGatewayPayload } from "../../types/gateway/gateway_payload.ts";
import { GuildBanAddRemove } from "../../types/guilds/guild_ban_add_remove.ts";
import type { DiscordGatewayPayload } from "../../types/gateway/gateway_payload.ts";
import type { GuildBanAddRemove } from "../../types/guilds/guild_ban_add_remove.ts";
import { snowflakeToBigint } from "../../util/bigint.ts";
export async function handleGuildBanAdd(data: DiscordGatewayPayload) {

View File

@@ -1,7 +1,7 @@
import { eventHandlers } from "../../bot.ts";
import { cacheHandlers } from "../../cache.ts";
import { DiscordGatewayPayload } from "../../types/gateway/gateway_payload.ts";
import { GuildBanAddRemove } from "../../types/guilds/guild_ban_add_remove.ts";
import type { DiscordGatewayPayload } from "../../types/gateway/gateway_payload.ts";
import type { GuildBanAddRemove } from "../../types/guilds/guild_ban_add_remove.ts";
import { snowflakeToBigint } from "../../util/bigint.ts";
export async function handleGuildBanRemove(data: DiscordGatewayPayload) {

View File

@@ -1,8 +1,8 @@
import { eventHandlers } from "../../bot.ts";
import { cache, cacheHandlers } from "../../cache.ts";
import { structures } from "../../structures/mod.ts";
import { DiscordGatewayPayload } from "../../types/gateway/gateway_payload.ts";
import { Guild } from "../../types/guilds/guild.ts";
import type { DiscordGatewayPayload } from "../../types/gateway/gateway_payload.ts";
import type { Guild } from "../../types/guilds/guild.ts";
import { snowflakeToBigint } from "../../util/bigint.ts";
import { ws } from "../../ws/ws.ts";

View File

@@ -1,7 +1,7 @@
import { eventHandlers } from "../../bot.ts";
import { cacheHandlers } from "../../cache.ts";
import { DiscordGatewayPayload } from "../../types/gateway/gateway_payload.ts";
import { UnavailableGuild } from "../../types/guilds/unavailable_guild.ts";
import type { DiscordGatewayPayload } from "../../types/gateway/gateway_payload.ts";
import type { UnavailableGuild } from "../../types/guilds/unavailable_guild.ts";
import { snowflakeToBigint } from "../../util/bigint.ts";
import { ws } from "../../ws/ws.ts";

View File

@@ -1,7 +1,7 @@
import { eventHandlers } from "../../bot.ts";
import { cacheHandlers } from "../../cache.ts";
import { DiscordGatewayPayload } from "../../types/gateway/gateway_payload.ts";
import { GuildIntegrationsUpdate } from "../../types/integration/guild_integrations_update.ts";
import type { DiscordGatewayPayload } from "../../types/gateway/gateway_payload.ts";
import type { GuildIntegrationsUpdate } from "../../types/integration/guild_integrations_update.ts";
import { snowflakeToBigint } from "../../util/bigint.ts";
export async function handleGuildIntegrationsUpdate(

View File

@@ -1,8 +1,8 @@
import { eventHandlers } from "../../bot.ts";
import { cacheHandlers } from "../../cache.ts";
import { GuildUpdateChange } from "../../types/discordeno/guild_update_change.ts";
import { DiscordGatewayPayload } from "../../types/gateway/gateway_payload.ts";
import { Guild } from "../../types/guilds/guild.ts";
import type { GuildUpdateChange } from "../../types/discordeno/guild_update_change.ts";
import type { DiscordGatewayPayload } from "../../types/gateway/gateway_payload.ts";
import type { Guild } from "../../types/guilds/guild.ts";
import { snowflakeToBigint } from "../../util/bigint.ts";
export async function handleGuildUpdate(data: DiscordGatewayPayload) {

View File

@@ -1,6 +1,6 @@
import { eventHandlers } from "../../bot.ts";
import { DiscordGatewayPayload } from "../../types/gateway/gateway_payload.ts";
import {
import type { DiscordGatewayPayload } from "../../types/gateway/gateway_payload.ts";
import type {
IntegrationCreateUpdate,
} from "../../types/integration/integration_create_update.ts";

View File

@@ -1,6 +1,6 @@
import { eventHandlers } from "../../bot.ts";
import { DiscordGatewayPayload } from "../../types/gateway/gateway_payload.ts";
import { IntegrationDelete } from "../../types/integration/integration_delete.ts";
import type { DiscordGatewayPayload } from "../../types/gateway/gateway_payload.ts";
import type { IntegrationDelete } from "../../types/integration/integration_delete.ts";
export function handleIntegrationDelete(data: DiscordGatewayPayload) {
eventHandlers.integrationDelete?.(

View File

@@ -1,6 +1,6 @@
import { eventHandlers } from "../../bot.ts";
import { DiscordGatewayPayload } from "../../types/gateway/gateway_payload.ts";
import {
import type { DiscordGatewayPayload } from "../../types/gateway/gateway_payload.ts";
import type {
IntegrationCreateUpdate,
} from "../../types/integration/integration_create_update.ts";

View File

@@ -1,9 +1,9 @@
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 { GuildMemberWithUser } from "../../types/guilds/guild_member.ts";
import { Interaction } from "../../types/interactions/interaction.ts";
import type { DiscordGatewayPayload } from "../../types/gateway/gateway_payload.ts";
import type { GuildMemberWithUser } from "../../types/guilds/guild_member.ts";
import type { Interaction } from "../../types/interactions/interaction.ts";
import { snowflakeToBigint } from "../../util/bigint.ts";
export async function handleInteractionCreate(data: DiscordGatewayPayload) {

View File

@@ -1,6 +1,6 @@
import { eventHandlers } from "../../bot.ts";
import { DiscordGatewayPayload } from "../../types/gateway/gateway_payload.ts";
import { InviteCreate } from "../../types/invites/invite_create.ts";
import type { DiscordGatewayPayload } from "../../types/gateway/gateway_payload.ts";
import type { InviteCreate } from "../../types/invites/invite_create.ts";
export function handleInviteCreate(data: DiscordGatewayPayload) {
eventHandlers.inviteCreate?.(

View File

@@ -1,6 +1,6 @@
import { eventHandlers } from "../../bot.ts";
import { DiscordGatewayPayload } from "../../types/gateway/gateway_payload.ts";
import { InviteDelete } from "../../types/invites/invite_delete.ts";
import type { DiscordGatewayPayload } from "../../types/gateway/gateway_payload.ts";
import type { InviteDelete } from "../../types/invites/invite_delete.ts";
export function handleInviteDelete(data: DiscordGatewayPayload) {
eventHandlers.inviteDelete?.(

View File

@@ -1,7 +1,7 @@
import { cache, cacheHandlers } from "../../cache.ts";
import { structures } from "../../structures/mod.ts";
import { DiscordGatewayPayload } from "../../types/gateway/gateway_payload.ts";
import { GuildMembersChunk } from "../../types/members/guild_members_chunk.ts";
import type { DiscordGatewayPayload } from "../../types/gateway/gateway_payload.ts";
import type { GuildMembersChunk } from "../../types/members/guild_members_chunk.ts";
import { snowflakeToBigint } from "../../util/bigint.ts";
import { Collection } from "../../util/collection.ts";

View File

@@ -1,8 +1,8 @@
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 { GuildMemberAdd } from "../../types/members/guild_member_add.ts";
import type { DiscordGatewayPayload } from "../../types/gateway/gateway_payload.ts";
import type { GuildMemberAdd } from "../../types/members/guild_member_add.ts";
import { snowflakeToBigint } from "../../util/bigint.ts";
export async function handleGuildMemberAdd(data: DiscordGatewayPayload) {

View File

@@ -1,7 +1,7 @@
import { eventHandlers } from "../../bot.ts";
import { cacheHandlers } from "../../cache.ts";
import { DiscordGatewayPayload } from "../../types/gateway/gateway_payload.ts";
import { GuildMemberRemove } from "../../types/members/guild_member_remove.ts";
import type { DiscordGatewayPayload } from "../../types/gateway/gateway_payload.ts";
import type { GuildMemberRemove } from "../../types/members/guild_member_remove.ts";
import { snowflakeToBigint } from "../../util/bigint.ts";
export async function handleGuildMemberRemove(data: DiscordGatewayPayload) {

View File

@@ -1,8 +1,8 @@
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 { GuildMemberUpdate } from "../../types/members/guild_member_update.ts";
import type { DiscordGatewayPayload } from "../../types/gateway/gateway_payload.ts";
import type { GuildMemberUpdate } from "../../types/members/guild_member_update.ts";
import { bigintToSnowflake, snowflakeToBigint } from "../../util/bigint.ts";
export async function handleGuildMemberUpdate(data: DiscordGatewayPayload) {

View File

@@ -1,9 +1,9 @@
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 { GuildMemberWithUser } from "../../types/guilds/guild_member.ts";
import { Message } from "../../types/messages/message.ts";
import type { DiscordGatewayPayload } from "../../types/gateway/gateway_payload.ts";
import type { GuildMemberWithUser } from "../../types/guilds/guild_member.ts";
import type { Message } from "../../types/messages/message.ts";
import { snowflakeToBigint } from "../../util/bigint.ts";
export async function handleMessageCreate(data: DiscordGatewayPayload) {

View File

@@ -1,7 +1,7 @@
import { eventHandlers } from "../../bot.ts";
import { cacheHandlers } from "../../cache.ts";
import { DiscordGatewayPayload } from "../../types/gateway/gateway_payload.ts";
import { MessageDelete } from "../../types/messages/message_delete.ts";
import type { DiscordGatewayPayload } from "../../types/gateway/gateway_payload.ts";
import type { MessageDelete } from "../../types/messages/message_delete.ts";
import { snowflakeToBigint } from "../../util/bigint.ts";
export async function handleMessageDelete(data: DiscordGatewayPayload) {

View File

@@ -1,7 +1,7 @@
import { eventHandlers } from "../../bot.ts";
import { cacheHandlers } from "../../cache.ts";
import { DiscordGatewayPayload } from "../../types/gateway/gateway_payload.ts";
import { MessageDeleteBulk } from "../../types/messages/message_delete_bulk.ts";
import type { DiscordGatewayPayload } from "../../types/gateway/gateway_payload.ts";
import type { MessageDeleteBulk } from "../../types/messages/message_delete_bulk.ts";
import { snowflakeToBigint } from "../../util/bigint.ts";
export async function handleMessageDeleteBulk(data: DiscordGatewayPayload) {

View File

@@ -1,8 +1,8 @@
import { botId, eventHandlers } from "../../bot.ts";
import { cacheHandlers } from "../../cache.ts";
import { structures } from "../../structures/mod.ts";
import { DiscordGatewayPayload } from "../../types/gateway/gateway_payload.ts";
import {
import type { DiscordGatewayPayload } from "../../types/gateway/gateway_payload.ts";
import type {
MessageReactionAdd,
} from "../../types/messages/message_reaction_add.ts";
import { snowflakeToBigint } from "../../util/bigint.ts";

View File

@@ -1,7 +1,7 @@
import { eventHandlers } from "../../bot.ts";
import { cacheHandlers } from "../../cache.ts";
import { DiscordGatewayPayload } from "../../types/gateway/gateway_payload.ts";
import {
import type { DiscordGatewayPayload } from "../../types/gateway/gateway_payload.ts";
import type {
MessageReactionRemove,
} from "../../types/messages/message_reaction_remove.ts";
import { snowflakeToBigint } from "../../util/bigint.ts";

View File

@@ -1,7 +1,7 @@
import { eventHandlers } from "../../bot.ts";
import { cacheHandlers } from "../../cache.ts";
import { DiscordGatewayPayload } from "../../types/gateway/gateway_payload.ts";
import {
import type { DiscordGatewayPayload } from "../../types/gateway/gateway_payload.ts";
import type {
MessageReactionRemoveAll,
} from "../../types/messages/message_reaction_remove_all.ts";
import { snowflakeToBigint } from "../../util/bigint.ts";

View File

@@ -1,7 +1,7 @@
import { eventHandlers } from "../../bot.ts";
import { cacheHandlers } from "../../cache.ts";
import { DiscordGatewayPayload } from "../../types/gateway/gateway_payload.ts";
import { MessageReactionRemoveEmoji } from "../../types/messages/message_reaction_remove_emoji.ts";
import type { DiscordGatewayPayload } from "../../types/gateway/gateway_payload.ts";
import type { MessageReactionRemoveEmoji } from "../../types/messages/message_reaction_remove_emoji.ts";
import { snowflakeToBigint } from "../../util/bigint.ts";
export async function handleMessageReactionRemoveEmoji(

View File

@@ -1,8 +1,8 @@
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 { Message } from "../../types/messages/message.ts";
import type { DiscordGatewayPayload } from "../../types/gateway/gateway_payload.ts";
import type { Message } from "../../types/messages/message.ts";
import { snowflakeToBigint } from "../../util/bigint.ts";
export async function handleMessageUpdate(data: DiscordGatewayPayload) {

View File

@@ -1,7 +1,7 @@
import { eventHandlers } from "../../bot.ts";
import { cacheHandlers } from "../../cache.ts";
import { DiscordGatewayPayload } from "../../types/gateway/gateway_payload.ts";
import { PresenceUpdate } from "../../types/misc/presence_update.ts";
import type { DiscordGatewayPayload } from "../../types/gateway/gateway_payload.ts";
import type { PresenceUpdate } from "../../types/misc/presence_update.ts";
import { snowflakeToBigint } from "../../util/bigint.ts";
export async function handlePresenceUpdate(data: DiscordGatewayPayload) {

View File

@@ -2,9 +2,9 @@ import { eventHandlers, setApplicationId, setBotId } from "../../bot.ts";
import { cache, cacheHandlers } from "../../cache.ts";
import { initialMemberLoadQueue } from "../../structures/guild.ts";
import { structures } from "../../structures/mod.ts";
import { DiscordGatewayPayload } from "../../types/gateway/gateway_payload.ts";
import { Ready } from "../../types/gateway/ready.ts";
import { GuildMemberWithUser } from "../../types/mod.ts";
import type { DiscordGatewayPayload } from "../../types/gateway/gateway_payload.ts";
import type { Ready } from "../../types/gateway/ready.ts";
import type { GuildMemberWithUser } from "../../types/mod.ts";
import { snowflakeToBigint } from "../../util/bigint.ts";
import { ws } from "../../ws/ws.ts";

View File

@@ -1,6 +1,6 @@
import { eventHandlers } from "../../bot.ts";
import { DiscordGatewayPayload } from "../../types/gateway/gateway_payload.ts";
import { TypingStart } from "../../types/misc/typing_start.ts";
import type { DiscordGatewayPayload } from "../../types/gateway/gateway_payload.ts";
import type { TypingStart } from "../../types/misc/typing_start.ts";
export function handleTypingStart(data: DiscordGatewayPayload) {
eventHandlers.typingStart?.(

View File

@@ -1,7 +1,7 @@
import { eventHandlers } from "../../bot.ts";
import { cacheHandlers } from "../../cache.ts";
import { DiscordGatewayPayload } from "../../types/gateway/gateway_payload.ts";
import { User } from "../../types/users/user.ts";
import type { DiscordGatewayPayload } from "../../types/gateway/gateway_payload.ts";
import type { User } from "../../types/users/user.ts";
import { snowflakeToBigint } from "../../util/bigint.ts";
export async function handleUserUpdate(data: DiscordGatewayPayload) {

View File

@@ -1,8 +1,8 @@
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 { GuildRoleCreate } from "../../types/mod.ts";
import type { DiscordGatewayPayload } from "../../types/gateway/gateway_payload.ts";
import type { GuildRoleCreate } from "../../types/mod.ts";
import { snowflakeToBigint } from "../../util/bigint.ts";
export async function handleGuildRoleCreate(data: DiscordGatewayPayload) {

View File

@@ -1,7 +1,7 @@
import { eventHandlers } from "../../bot.ts";
import { cacheHandlers } from "../../cache.ts";
import { DiscordGatewayPayload } from "../../types/gateway/gateway_payload.ts";
import { GuildRoleDelete } from "../../types/guilds/guild_role_delete.ts";
import type { DiscordGatewayPayload } from "../../types/gateway/gateway_payload.ts";
import type { GuildRoleDelete } from "../../types/guilds/guild_role_delete.ts";
import { snowflakeToBigint } from "../../util/bigint.ts";
export async function handleGuildRoleDelete(data: DiscordGatewayPayload) {

View File

@@ -1,8 +1,8 @@
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 { GuildRoleUpdate } from "../../types/mod.ts";
import type { DiscordGatewayPayload } from "../../types/gateway/gateway_payload.ts";
import type { GuildRoleUpdate } from "../../types/mod.ts";
import { snowflakeToBigint } from "../../util/bigint.ts";
export async function handleGuildRoleUpdate(data: DiscordGatewayPayload) {

View File

@@ -1,7 +1,7 @@
import { eventHandlers } from "../../bot.ts";
import { cacheHandlers } from "../../cache.ts";
import { DiscordGatewayPayload } from "../../types/gateway/gateway_payload.ts";
import { VoiceServerUpdate } from "../../types/voice/voice_server_update.ts";
import type { DiscordGatewayPayload } from "../../types/gateway/gateway_payload.ts";
import type { VoiceServerUpdate } from "../../types/voice/voice_server_update.ts";
import { snowflakeToBigint } from "../../util/bigint.ts";
export async function handleVoiceServerUpdate(data: DiscordGatewayPayload) {

View File

@@ -1,8 +1,8 @@
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 { VoiceState } from "../../types/voice/voice_state.ts";
import type { DiscordGatewayPayload } from "../../types/gateway/gateway_payload.ts";
import type { VoiceState } from "../../types/voice/voice_state.ts";
import { snowflakeToBigint } from "../../util/bigint.ts";
export async function handleVoiceStateUpdate(data: DiscordGatewayPayload) {

View File

@@ -1,6 +1,6 @@
import { eventHandlers } from "../../bot.ts";
import { DiscordGatewayPayload } from "../../types/gateway/gateway_payload.ts";
import { WebhookUpdate } from "../../types/webhooks/webhooks_update.ts";
import type { DiscordGatewayPayload } from "../../types/gateway/gateway_payload.ts";
import type { WebhookUpdate } from "../../types/webhooks/webhooks_update.ts";
import { snowflakeToBigint } from "../../util/bigint.ts";
export function handleWebhooksUpdate(data: DiscordGatewayPayload) {

View File

@@ -1,6 +1,6 @@
import { DiscordOverwrite } from "../../types/channels/overwrite.ts";
import type { DiscordOverwrite } from "../../types/channels/overwrite.ts";
import { DiscordBitwisePermissionFlags } from "../../types/permissions/bitwise_permission_flags.ts";
import { PermissionStrings } from "../../types/permissions/permission_strings.ts";
import type { PermissionStrings } from "../../types/permissions/permission_strings.ts";
/** Checks if a channel overwrite for a user id or a role id has permission in this channel */
export function channelOverwriteHasPermission(

View File

@@ -1,6 +1,6 @@
import { cacheHandlers } from "../../cache.ts";
import { DiscordChannelTypes } from "../../types/channels/channel_types.ts";
import { CreateGuildChannel } from "../../types/guilds/create_guild_channel.ts";
import type { CreateGuildChannel } from "../../types/guilds/create_guild_channel.ts";
import { Errors } from "../../types/misc/errors.ts";
import { bigintToSnowflake } from "../../util/bigint.ts";
import { calculatePermissions } from "../../util/permissions.ts";

View File

@@ -1,9 +1,9 @@
import { cacheHandlers } from "../../cache.ts";
import { rest } from "../../rest/rest.ts";
import { structures } from "../../structures/mod.ts";
import { Channel } from "../../types/channels/channel.ts";
import type { Channel } from "../../types/channels/channel.ts";
import { DiscordChannelTypes } from "../../types/channels/channel_types.ts";
import {
import type {
CreateGuildChannel,
DiscordCreateGuildChannel,
} from "../../types/guilds/create_guild_channel.ts";

View File

@@ -1,13 +1,11 @@
import { eventHandlers } from "../../bot.ts";
import { cacheHandlers } from "../../cache.ts";
import { rest } from "../../rest/rest.ts";
import { ModifyChannel } from "../../types/channels/modify_channel.ts";
import { ModifyThread } from "../../types/channels/threads/modify_thread.ts";
import {
Channel,
DiscordChannelTypes,
PermissionStrings,
} from "../../types/mod.ts";
import type { Channel } from "../../types/channels/channel.ts";
import { DiscordChannelTypes } from "../../types/channels/channel_types.ts";
import type { ModifyChannel } from "../../types/channels/modify_channel.ts";
import type { ModifyThread } from "../../types/channels/threads/modify_thread.ts";
import type { PermissionStrings } from "../../types/permissions/permission_strings.ts";
import { endpoints } from "../../util/constants.ts";
import {
calculateBits,

View File

@@ -1,5 +1,5 @@
import { rest } from "../../rest/rest.ts";
import { Overwrite } from "../../types/channels/overwrite.ts";
import type { Overwrite } from "../../types/channels/overwrite.ts";
import { endpoints } from "../../util/constants.ts";
import {
calculateBits,

View File

@@ -1,5 +1,5 @@
import { rest } from "../../rest/rest.ts";
import { FollowedChannel } from "../../types/channels/followed_channel.ts";
import type { FollowedChannel } from "../../types/channels/followed_channel.ts";
import { endpoints } from "../../util/constants.ts";
import { requireBotChannelPermissions } from "../../util/permissions.ts";

View File

@@ -1,7 +1,7 @@
import { cacheHandlers } from "../../cache.ts";
import { rest } from "../../rest/rest.ts";
import { structures } from "../../structures/mod.ts";
import { Channel } from "../../types/channels/channel.ts";
import type { Channel } from "../../types/channels/channel.ts";
import { snowflakeToBigint } from "../../util/bigint.ts";
import { endpoints } from "../../util/constants.ts";

View File

@@ -1,5 +1,5 @@
import { rest } from "../../rest/rest.ts";
import { Webhook } from "../../types/webhooks/webhook.ts";
import type { Webhook } from "../../types/webhooks/webhook.ts";
import { Collection } from "../../util/collection.ts";
import { endpoints } from "../../util/constants.ts";
import { requireBotChannelPermissions } from "../../util/permissions.ts";

View File

@@ -1,7 +1,7 @@
import { cacheHandlers } from "../../cache.ts";
import { rest } from "../../rest/rest.ts";
import { structures } from "../../structures/mod.ts";
import { Channel } from "../../types/channels/channel.ts";
import type { Channel } from "../../types/channels/channel.ts";
import { Collection } from "../../util/collection.ts";
import { endpoints } from "../../util/constants.ts";

View File

@@ -1,6 +1,6 @@
import { rest } from "../../rest/rest.ts";
import { structures } from "../../structures/mod.ts";
import { Message } from "../../types/messages/message.ts";
import type { Message } from "../../types/messages/message.ts";
import { endpoints } from "../../util/constants.ts";
/** Get pinned messages in this channel. */

View File

@@ -1,5 +1,5 @@
import { rest } from "../../rest/rest.ts";
import { ModifyGuildChannelPositions } from "../../types/guilds/modify_guild_channel_position.ts";
import type { ModifyGuildChannelPositions } from "../../types/guilds/modify_guild_channel_position.ts";
import { endpoints } from "../../util/constants.ts";
/** Modify the positions of channels on the guild. Requires MANAGE_CHANNELS permisison. */

View File

@@ -1,6 +1,6 @@
import { applicationId } from "../../bot.ts";
import { rest } from "../../rest/rest.ts";
import { ApplicationCommandPermissions } from "../../types/interactions/application_command_permissions.ts";
import type { ApplicationCommandPermissions } from "../../types/interactions/application_command_permissions.ts";
import { endpoints } from "../../util/constants.ts";
import { camelKeysToSnakeCase } from "../../util/utils.ts";

View File

@@ -1,7 +1,7 @@
import { applicationId } from "../../bot.ts";
import { rest } from "../../rest/rest.ts";
import { CreateGlobalApplicationCommand } from "../../types/interactions/create_global_application_command.ts";
import { ApplicationCommand } from "../../types/mod.ts";
import type { ApplicationCommand } from "../../types/interactions/application_command.ts";
import type { CreateGlobalApplicationCommand } from "../../types/interactions/create_global_application_command.ts";
import { endpoints } from "../../util/constants.ts";
import {
camelKeysToSnakeCase,

View File

@@ -1,6 +1,6 @@
import { applicationId } from "../../bot.ts";
import { rest } from "../../rest/rest.ts";
import { ApplicationCommandPermissions } from "../../types/interactions/application_command_permissions.ts";
import type { ApplicationCommandPermissions } from "../../types/interactions/application_command_permissions.ts";
import { endpoints } from "../../util/constants.ts";
import { camelKeysToSnakeCase } from "../../util/utils.ts";

View File

@@ -1,7 +1,7 @@
import { applicationId } from "../../bot.ts";
import { rest } from "../../rest/rest.ts";
import { structures } from "../../structures/mod.ts";
import { DiscordenoEditWebhookMessage } from "../../types/discordeno/edit_webhook_message.ts";
import type { DiscordenoEditWebhookMessage } from "../../types/discordeno/edit_webhook_message.ts";
import { DiscordAllowedMentionsTypes } from "../../types/messages/allowed_mentions_types.ts";
import { Errors } from "../../types/misc/errors.ts";
import { endpoints } from "../../util/constants.ts";

View File

@@ -1,6 +1,6 @@
import { applicationId } from "../../bot.ts";
import { rest } from "../../rest/rest.ts";
import { ApplicationCommand } from "../../types/interactions/application_command.ts";
import type { ApplicationCommand } from "../../types/interactions/application_command.ts";
import { endpoints } from "../../util/constants.ts";
/** Fetchs the global command for the given Id. If a guildId is provided, the guild command will be fetched. */

View File

@@ -1,6 +1,6 @@
import { applicationId } from "../../bot.ts";
import { rest } from "../../rest/rest.ts";
import { GuildApplicationCommandPermissions } from "../../types/interactions/guild_application_command_permissions.ts";
import type { 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. */

View File

@@ -1,6 +1,6 @@
import { applicationId } from "../../bot.ts";
import { rest } from "../../rest/rest.ts";
import { GuildApplicationCommandPermissions } from "../../types/interactions/guild_application_command_permissions.ts";
import type { 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. */

View File

@@ -1,6 +1,6 @@
import { applicationId } from "../../bot.ts";
import { rest } from "../../rest/rest.ts";
import { ApplicationCommand } from "../../types/interactions/application_command.ts";
import type { ApplicationCommand } from "../../types/interactions/application_command.ts";
import { Collection } from "../../util/collection.ts";
import { endpoints } from "../../util/constants.ts";

View File

@@ -1,7 +1,7 @@
import { applicationId, eventHandlers } from "../../bot.ts";
import { cache } from "../../cache.ts";
import { rest } from "../../rest/rest.ts";
import { DiscordenoInteractionResponse } from "../../types/discordeno/interaction_response.ts";
import type { DiscordenoInteractionResponse } from "../../types/discordeno/interaction_response.ts";
import { endpoints } from "../../util/constants.ts";
/**

View File

@@ -1,7 +1,7 @@
import { applicationId } from "../../bot.ts";
import { rest } from "../../rest/rest.ts";
import { EditGlobalApplicationCommand } from "../../types/interactions/edit_global_application_command.ts";
import { ApplicationCommand } from "../../types/mod.ts";
import type { ApplicationCommand } from "../../types/interactions/application_command.ts";
import type { EditGlobalApplicationCommand } from "../../types/interactions/edit_global_application_command.ts";
import { endpoints } from "../../util/constants.ts";
import { validateSlashCommands } from "../../util/utils.ts";

View File

@@ -1,7 +1,7 @@
import { applicationId } from "../../bot.ts";
import { rest } from "../../rest/rest.ts";
import { EditGlobalApplicationCommand } from "../../types/interactions/edit_global_application_command.ts";
import { ApplicationCommand } from "../../types/mod.ts";
import type { ApplicationCommand } from "../../types/interactions/application_command.ts";
import type { EditGlobalApplicationCommand } from "../../types/interactions/edit_global_application_command.ts";
import { endpoints } from "../../util/constants.ts";
import { validateSlashCommands } from "../../util/utils.ts";

View File

@@ -1,5 +1,5 @@
import { rest } from "../../rest/rest.ts";
import {
import type {
AddGuildDiscoverySubcategory,
} from "../../types/discovery/add_guild_discovery_subcategory.ts";
import { endpoints } from "../../util/constants.ts";

View File

@@ -1,6 +1,6 @@
import { rest } from "../../rest/rest.ts";
import { DiscoveryMetadata } from "../../types/discovery/discovery_metadata.ts";
import { ModifyGuildDiscoveryMetadata } from "../../types/discovery/modify_guild_discovery_metadata.ts";
import type { DiscoveryMetadata } from "../../types/discovery/discovery_metadata.ts";
import type { ModifyGuildDiscoveryMetadata } from "../../types/discovery/modify_guild_discovery_metadata.ts";
import { endpoints } from "../../util/constants.ts";
import { requireBotGuildPermissions } from "../../util/permissions.ts";
import { camelKeysToSnakeCase } from "../../util/utils.ts";

View File

@@ -1,5 +1,5 @@
import { rest } from "../../rest/rest.ts";
import { DiscoveryCategory } from "../../types/discovery/discovery_category.ts";
import type { DiscoveryCategory } from "../../types/discovery/discovery_category.ts";
import { Collection } from "../../util/collection.ts";
import { endpoints } from "../../util/constants.ts";

View File

@@ -1,5 +1,5 @@
import { rest } from "../../rest/rest.ts";
import { ValidateDiscoverySearchTerm } from "../../types/discovery/validate_discovery_search_term.ts";
import type { ValidateDiscoverySearchTerm } from "../../types/discovery/validate_discovery_search_term.ts";
import { endpoints } from "../../util/constants.ts";
export async function validDiscoveryTerm(term: string) {

View File

@@ -1,6 +1,6 @@
import { rest } from "../../rest/rest.ts";
import { CreateGuildEmoji } from "../../types/emojis/create_guild_emoji.ts";
import { Emoji } from "../../types/emojis/emoji.ts";
import type { Emoji } from "../../types/emojis/emoji.ts";
import { snowflakeToBigint } from "../../util/bigint.ts";
import { endpoints } from "../../util/constants.ts";
import { requireBotGuildPermissions } from "../../util/permissions.ts";

View File

@@ -1,6 +1,6 @@
import { rest } from "../../rest/rest.ts";
import { ModifyGuildEmoji } from "../../types/emojis/modify_guild_emoji.ts";
import { Emoji } from "../../types/mod.ts";
import type { Emoji } from "../../types/emojis/emoji.ts";
import type { ModifyGuildEmoji } from "../../types/emojis/modify_guild_emoji.ts";
import { endpoints } from "../../util/constants.ts";
import { requireBotGuildPermissions } from "../../util/permissions.ts";

View File

@@ -1,6 +1,6 @@
import { cacheHandlers } from "../../cache.ts";
import { rest } from "../../rest/rest.ts";
import { Emoji } from "../../types/emojis/emoji.ts";
import type { Emoji } from "../../types/emojis/emoji.ts";
import { Errors } from "../../types/misc/errors.ts";
import { endpoints } from "../../util/constants.ts";

View File

@@ -1,7 +1,7 @@
import { eventHandlers } from "../../bot.ts";
import { cacheHandlers } from "../../cache.ts";
import { rest } from "../../rest/rest.ts";
import { Emoji } from "../../types/emojis/emoji.ts";
import type { Emoji } from "../../types/emojis/emoji.ts";
import { Errors } from "../../types/misc/errors.ts";
import { snowflakeToBigint } from "../../util/bigint.ts";
import { Collection } from "../../util/collection.ts";

View File

@@ -2,8 +2,8 @@ import { botId } from "../../bot.ts";
import { cacheHandlers } from "../../cache.ts";
import { rest } from "../../rest/rest.ts";
import { structures } from "../../structures/mod.ts";
import { CreateGuild } from "../../types/guilds/create_guild.ts";
import { Guild } from "../../types/guilds/guild.ts";
import type { CreateGuild } from "../../types/guilds/create_guild.ts";
import type { Guild } from "../../types/guilds/guild.ts";
import { endpoints } from "../../util/constants.ts";
import { getMember } from "../members/get_member.ts";

View File

@@ -1,8 +1,8 @@
import { cacheHandlers } from "../../cache.ts";
import { rest } from "../../rest/rest.ts";
import { structures } from "../../structures/mod.ts";
import { Guild } from "../../types/guilds/guild.ts";
import { ModifyGuild } from "../../types/guilds/modify_guild.ts";
import type { Guild } from "../../types/guilds/guild.ts";
import type { ModifyGuild } from "../../types/guilds/modify_guild.ts";
import { endpoints } from "../../util/constants.ts";
import { requireBotGuildPermissions } from "../../util/permissions.ts";
import { urlToBase64 } from "../../util/utils.ts";

View File

@@ -1,6 +1,6 @@
import { rest } from "../../rest/rest.ts";
import { ModifyGuildWelcomeScreen } from "../../types/guilds/modify_guild_welcome_screen.ts";
import { WelcomeScreen } from "../../types/mod.ts";
import type { ModifyGuildWelcomeScreen } from "../../types/guilds/modify_guild_welcome_screen.ts";
import type { WelcomeScreen } from "../../types/guilds/welcome_screen.ts";
import { endpoints } from "../../util/constants.ts";
import { camelKeysToSnakeCase } from "../../util/utils.ts";

View File

@@ -1,5 +1,5 @@
import { rest } from "../../rest/rest.ts";
import { GuildWidget } from "../../types/guilds/guild_widget.ts";
import type { GuildWidget } from "../../types/guilds/guild_widget.ts";
import { endpoints } from "../../util/constants.ts";
import { requireBotGuildPermissions } from "../../util/permissions.ts";

View File

@@ -1,6 +1,6 @@
import { rest } from "../../rest/rest.ts";
import { AuditLog } from "../../types/audit_log/audit_log.ts";
import { GetGuildAuditLog } from "../../types/audit_log/get_guild_audit_log.ts";
import type { AuditLog } from "../../types/audit_log/audit_log.ts";
import type { GetGuildAuditLog } from "../../types/audit_log/get_guild_audit_log.ts";
import { endpoints } from "../../util/constants.ts";
import { requireBotGuildPermissions } from "../../util/permissions.ts";
import { camelKeysToSnakeCase } from "../../util/utils.ts";

View File

@@ -1,5 +1,5 @@
import { rest } from "../../rest/rest.ts";
import { VoiceRegion } from "../../types/voice/voice_region.ts";
import type { VoiceRegion } from "../../types/voice/voice_region.ts";
import { endpoints } from "../../util/constants.ts";
/** Returns an array of voice regions that can be used when creating servers. */

View File

@@ -1,5 +1,5 @@
import { rest } from "../../rest/rest.ts";
import { Ban } from "../../types/guilds/ban.ts";
import type { Ban } from "../../types/guilds/ban.ts";
import { endpoints } from "../../util/constants.ts";
import { requireBotGuildPermissions } from "../../util/permissions.ts";

View File

@@ -1,5 +1,5 @@
import { rest } from "../../rest/rest.ts";
import { Ban } from "../../types/guilds/ban.ts";
import type { Ban } from "../../types/guilds/ban.ts";
import { snowflakeToBigint } from "../../util/bigint.ts";
import { Collection } from "../../util/collection.ts";
import { endpoints } from "../../util/constants.ts";

View File

@@ -1,7 +1,7 @@
import { cacheHandlers } from "../../cache.ts";
import { rest } from "../../rest/rest.ts";
import { structures } from "../../structures/mod.ts";
import { Guild } from "../../types/guilds/guild.ts";
import type { Guild } from "../../types/guilds/guild.ts";
import { endpoints } from "../../util/constants.ts";
import { ws } from "../../ws/ws.ts";

View File

@@ -1,5 +1,5 @@
import { rest } from "../../rest/rest.ts";
import { GuildPreview } from "../../types/guilds/guild_preview.ts";
import type { GuildPreview } from "../../types/guilds/guild_preview.ts";
import { endpoints } from "../../util/constants.ts";
/** Returns the guild preview object for the given id. If the bot is not in the guild, then the guild must be Discoverable. */

View File

@@ -1,5 +1,5 @@
import { rest } from "../../rest/rest.ts";
import { GetGuildPruneCountQuery } from "../../types/guilds/get_guild_prune_count.ts";
import type { GetGuildPruneCountQuery } from "../../types/guilds/get_guild_prune_count.ts";
import { Errors } from "../../types/misc/errors.ts";
import { endpoints } from "../../util/constants.ts";
import { requireBotGuildPermissions } from "../../util/permissions.ts";

View File

@@ -1,5 +1,5 @@
import { rest } from "../../rest/rest.ts";
import { InviteMetadata } from "../../types/invites/invite_metadata.ts";
import type { InviteMetadata } from "../../types/invites/invite_metadata.ts";
import { endpoints } from "../../util/constants.ts";
/** Returns the code and uses of the vanity url for this server if it is enabled else `code` will be null. Requires the `MANAGE_GUILD` permission. */

View File

@@ -1,5 +1,5 @@
import { rest } from "../../rest/rest.ts";
import { VoiceRegion } from "../../types/voice/voice_region.ts";
import type { VoiceRegion } from "../../types/voice/voice_region.ts";
import { Collection } from "../../util/collection.ts";
import { endpoints } from "../../util/constants.ts";

View File

@@ -1,5 +1,5 @@
import { rest } from "../../rest/rest.ts";
import { WelcomeScreen } from "../../types/mod.ts";
import type { WelcomeScreen } from "../../types/mod.ts";
import { endpoints } from "../../util/constants.ts";
export async function getWelcomeScreen(guildId: bigint) {

View File

@@ -1,6 +1,6 @@
import { cacheHandlers } from "../../cache.ts";
import { rest } from "../../rest/rest.ts";
import { GuildWidgetDetails } from "../../types/guilds/guild_widget_details.ts";
import type { GuildWidgetDetails } from "../../types/guilds/guild_widget_details.ts";
import { Errors } from "../../types/misc/errors.ts";
import { endpoints } from "../../util/constants.ts";

View File

@@ -1,5 +1,5 @@
import { cacheHandlers } from "../../cache.ts";
import { GetGuildWidgetImageQuery } from "../../types/guilds/get_guild_widget_image.ts";
import type { GetGuildWidgetImageQuery } from "../../types/guilds/get_guild_widget_image.ts";
import { Errors } from "../../types/misc/errors.ts";
import { endpoints } from "../../util/constants.ts";

View File

@@ -1,5 +1,5 @@
import { rest } from "../../rest/rest.ts";
import { GuildWidget } from "../../types/guilds/guild_widget.ts";
import type { GuildWidget } from "../../types/guilds/guild_widget.ts";
import { endpoints } from "../../util/constants.ts";
import { requireBotGuildPermissions } from "../../util/permissions.ts";

View File

@@ -1,5 +1,5 @@
import { DiscordImageFormat } from "../../types/misc/image_format.ts";
import { DiscordImageSize } from "../../types/misc/image_size.ts";
import type { DiscordImageFormat } from "../../types/misc/image_format.ts";
import type { DiscordImageSize } from "../../types/misc/image_size.ts";
import { endpoints } from "../../util/constants.ts";
import { formatImageURL } from "../../util/utils.ts";

View File

@@ -1,5 +1,5 @@
import { DiscordImageFormat } from "../../types/misc/image_format.ts";
import { DiscordImageSize } from "../../types/misc/image_size.ts";
import type { DiscordImageFormat } from "../../types/misc/image_format.ts";
import type { DiscordImageSize } from "../../types/misc/image_size.ts";
import { endpoints } from "../../util/constants.ts";
import { formatImageURL } from "../../util/utils.ts";

View File

@@ -1,5 +1,5 @@
import { DiscordImageFormat } from "../../types/misc/image_format.ts";
import { DiscordImageSize } from "../../types/misc/image_size.ts";
import type { DiscordImageFormat } from "../../types/misc/image_format.ts";
import type { DiscordImageSize } from "../../types/misc/image_size.ts";
import { endpoints } from "../../util/constants.ts";
import { formatImageURL } from "../../util/utils.ts";

View File

@@ -1,6 +1,5 @@
import { RequestManager } from "../../rest/request_manager.ts";
import {
DiscordUpdateSelfVoiceState,
import { rest } from "../../rest/rest.ts";
import type {
UpdateSelfVoiceState,
} from "../../types/guilds/update_self_voice_state.ts";
import { endpoints } from "../../util/constants.ts";
@@ -15,14 +14,13 @@ import { camelKeysToSnakeCase } from "../../util/utils.ts";
* - You must have the `REQUEST_TO_SPEAK` permission to request to speak. You can always clear your own request to speak.
* - You are able to set `request_to_speak_timestamp` to any present or future time.
*/
export function updateBotVoiceState(
export async function updateBotVoiceState(
guildId: bigint,
data: UpdateSelfVoiceState,
) {
const payload = camelKeysToSnakeCase<DiscordUpdateSelfVoiceState>(data);
return RequestManager.patch(
return await rest.runMethod(
"patch",
endpoints.UPDATE_VOICE_STATE(guildId),
payload,
camelKeysToSnakeCase(data),
);
}

View File

@@ -1,6 +1,5 @@
import { RequestManager } from "../../rest/request_manager.ts";
import {
DiscordUpdateOthersVoiceState,
import { rest } from "../../rest/rest.ts";
import type {
UpdateOthersVoiceState,
} from "../../types/guilds/update_others_voice_state.ts";
import { endpoints } from "../../util/constants.ts";
@@ -20,10 +19,9 @@ export function updateVoiceState(
userId: bigint,
data: UpdateOthersVoiceState,
) {
const payload = camelKeysToSnakeCase<DiscordUpdateOthersVoiceState>(data);
return RequestManager.patch(
return rest.runMethod(
"patch",
endpoints.UPDATE_VOICE_STATE(guildId, userId),
payload,
camelKeysToSnakeCase(data),
);
}

View File

@@ -1,5 +1,5 @@
import { rest } from "../../rest/rest.ts";
import { Integration } from "../../types/mod.ts";
import type { Integration } from "../../types/integration/integration.ts";
import { endpoints } from "../../util/constants.ts";
import { requireBotGuildPermissions } from "../../util/permissions.ts";

View File

@@ -1,6 +1,6 @@
import { rest } from "../../rest/rest.ts";
import { CreateChannelInvite } from "../../types/invites/create_channel_invite.ts";
import { Invite } from "../../types/invites/invite.ts";
import type { CreateChannelInvite } from "../../types/invites/create_channel_invite.ts";
import type { Invite } from "../../types/invites/invite.ts";
import { Errors } from "../../types/misc/errors.ts";
import { endpoints } from "../../util/constants.ts";
import { requireBotChannelPermissions } from "../../util/permissions.ts";

View File

@@ -1,6 +1,6 @@
import { cacheHandlers } from "../../cache.ts";
import { rest } from "../../rest/rest.ts";
import { Invite } from "../../types/invites/invite.ts";
import type { Invite } from "../../types/invites/invite.ts";
import { Errors } from "../../types/misc/errors.ts";
import { endpoints } from "../../util/constants.ts";
import {

Some files were not shown because too many files have changed in this diff Show More