fixing: bot

This commit is contained in:
H01001000
2022-12-01 16:06:33 +08:00
parent 6964d865cd
commit 592ea91c36
324 changed files with 444 additions and 623 deletions

View File

@@ -22,6 +22,7 @@
"@discordeno/gateway": "18.0.0-alpha.1",
"@discordeno/rest": "18.0.0-alpha.1",
"@discordeno/types": "18.0.0-alpha.1",
"@discordeno/utils": "18.0.0-alpha.1",
"typescript": "^4.9.3"
},
"dependencies": {

View File

@@ -1,7 +1,13 @@
import { createGatewayManager } from './gateway/manager/gatewayManager.js'
import * as handlers from './handlers/mod.js'
import * as helpers from './helpers/mod.js'
import { createRestManager, CreateRestManagerOptions } from './rest/mod.js'
import { calculateShardId, createGatewayManager, CreateShardManager, ShardSocketCloseCodes } from '@discordeno/gateway'
import { createRestManager, CreateRestManagerOptions } from '@discordeno/rest'
import {
AllowedMentions, BigString, DiscordActivity, DiscordAllowedMentions, DiscordApplication, DiscordApplicationCommand, DiscordApplicationCommandOption, DiscordApplicationCommandOptionChoice, DiscordAttachment, DiscordAuditLogEntry, DiscordAutoModerationActionExecution, DiscordAutoModerationRule, DiscordChannel, DiscordComponent, DiscordCreateApplicationCommand, DiscordEmbed, DiscordEmoji, DiscordGatewayPayload, DiscordGetGatewayBot, DiscordGuild, DiscordGuildApplicationCommandPermissions, DiscordGuildWidget, DiscordGuildWidgetSettings, DiscordIntegrationCreateUpdate, DiscordInteraction, DiscordInteractionDataOption, DiscordInteractionResponse, DiscordInviteCreate, DiscordMember, DiscordMessage, DiscordPresenceUpdate, DiscordReady, DiscordRole, DiscordScheduledEvent, DiscordStageInstance, DiscordSticker, DiscordStickerPack, DiscordTeam, DiscordTemplate, DiscordThreadMember, DiscordUser, DiscordVoiceRegion, DiscordVoiceState, DiscordWebhook, DiscordWelcomeScreen, Errors, GatewayDispatchEventNames, GatewayIntents, GetGatewayBot
} from '@discordeno/types'
import {
baseEndpoints, bigintToSnowflake, calculateBits, calculatePermissions, CHANNEL_MENTION_REGEX, Collection, CONTEXT_MENU_COMMANDS_NAME_REGEX, DISCORDENO_VERSION, DISCORD_SNOWFLAKE_REGEX, getBotIdFromToken, iconBigintToHash, iconHashToBigInt, removeTokenPrefix, SLASH_COMMANDS_NAME_REGEX, snowflakeToBigint, urlToBase64, USER_AGENT, validateLength
} from '@discordeno/utils'
import * as handlers from './handlers/index.js'
import * as helpers from './helpers/index.js'
import { Activity, transformActivity } from './transformers/activity.js'
import { Application, transformApplication } from './transformers/application.js'
import { ApplicationCommand, transformApplicationCommand } from './transformers/applicationCommand.js'
@@ -12,140 +18,19 @@ import { AuditLogEntry, transformAuditLogEntry } from './transformers/auditLogEn
import { Component, transformComponent } from './transformers/component.js'
import { Embed, transformEmbed } from './transformers/embed.js'
import { Emoji, transformEmoji } from './transformers/emoji.js'
import { GetGatewayBot, transformGatewayBot } from './transformers/gatewayBot.js'
import { Integration, transformIntegration } from './transformers/integration.js'
import { transformGatewayBot } from './transformers/gatewayBot.js'
import {
Interaction,
InteractionDataOption,
transformInteraction,
transformInteractionDataOption
} from './transformers/interaction.js'
import { Invite, transformInvite } from './transformers/invite.js'
ApplicationCommandOptionChoice, AutoModerationActionExecution, AutoModerationRule, Channel, Guild, GuildWidget, GuildWidgetSettings, Integration, Interaction, InteractionDataOption, Invite, Member, Message, PresenceUpdate, Role, ScheduledEvent, StageInstance, Sticker, StickerPack, Team, Template, ThreadMember, transformActivityToDiscordActivity, transformAllowedMentionsToDiscordAllowedMentions, transformApplicationCommandOptionChoice, transformApplicationCommandOptionChoiceToDiscordApplicationCommandOptionChoice, transformApplicationCommandOptionToDiscordApplicationCommandOption, transformApplicationCommandToDiscordApplicationCommand, transformApplicationToDiscordApplication, transformAttachmentToDiscordAttachment, transformAutoModerationActionExecution, transformAutoModerationRule, transformChannel, transformComponentToDiscordComponent, transformCreateApplicationCommandToDiscordCreateApplicationCommand, transformEmbedToDiscordEmbed, transformGuild, transformIntegration, transformInteraction, transformInteractionDataOption, transformInteractionResponseToDiscordInteractionResponse, transformInvite, transformMember, transformMemberToDiscordMember, transformMessage, transformPresence, transformRole, transformScheduledEvent, transformStageInstance, transformSticker, transformStickerPack, transformTeam, transformTeamToDiscordTeam, transformTemplate, transformThreadMember, transformUser, transformUserToDiscordUser, transformVoiceRegion, transformVoiceState, transformWebhook, transformWelcomeScreen, transformWidget, transformWidgetSettings, User, VoiceRegions, VoiceState, Webhook, WelcomeScreen
} from './transformers/index.js'
import {
Channel,
Guild,
Member,
Message,
Role,
ScheduledEvent,
Template,
transformApplicationCommandToDiscordApplicationCommand,
transformAttachmentToDiscordAttachment,
transformChannel,
transformGuild,
transformMember,
transformMessage,
transformRole,
transformTemplate,
transformUser,
transformVoiceState,
User,
VoiceState
} from './transformers/mod.js'
import { PresenceUpdate, transformPresence } from './transformers/presence.js'
import { transformScheduledEvent } from './transformers/scheduledEvent.js'
import { StageInstance, transformStageInstance } from './transformers/stageInstance.js'
import { Sticker, StickerPack, transformSticker, transformStickerPack } from './transformers/sticker.js'
import { transformTeam, Team } from './transformers/team.js'
import { ThreadMember, transformThreadMember } from './transformers/threadMember.js'
import { transformVoiceRegion, VoiceRegions } from './transformers/voiceRegion.js'
import { transformWebhook, Webhook } from './transformers/webhook.js'
import { transformWelcomeScreen, WelcomeScreen } from './transformers/welcomeScreen.js'
import { transformWidget, GuildWidget } from './transformers/widget.js'
import { transformWidgetSettings, GuildWidgetSettings } from './transformers/widgetSettings.js'
import {
DiscordAllowedMentions,
DiscordApplicationCommandOptionChoice,
DiscordAutoModerationActionExecution,
DiscordAutoModerationRule,
DiscordCreateApplicationCommand,
DiscordEmoji,
DiscordGatewayPayload,
DiscordInteractionDataOption,
DiscordInteractionResponse,
DiscordReady,
DiscordStickerPack,
DiscordTemplate
,
DiscordActivity,
DiscordApplication,
DiscordApplicationCommand,
DiscordApplicationCommandOption,
DiscordAttachment,
DiscordAuditLogEntry,
DiscordChannel,
DiscordComponent,
DiscordEmbed,
DiscordGetGatewayBot,
DiscordGuild,
DiscordGuildApplicationCommandPermissions,
DiscordGuildWidget,
DiscordGuildWidgetSettings,
DiscordIntegrationCreateUpdate,
DiscordInteraction,
DiscordInviteCreate,
DiscordMember,
DiscordMessage,
DiscordPresenceUpdate,
DiscordRole,
DiscordScheduledEvent,
DiscordStageInstance,
DiscordSticker,
DiscordTeam,
DiscordThreadMember,
DiscordUser,
DiscordVoiceRegion,
DiscordVoiceState,
DiscordWebhook,
DiscordWelcomeScreen
} from './types/discord.js'
import { BigString, Errors, GatewayDispatchEventNames, GatewayIntents } from './types/shared.js'
import { bigintToSnowflake, snowflakeToBigint } from './util/bigint.js'
import { calculateShardId } from './util/calculateShardId.js'
import { Collection } from './util/collection.js'
import {
baseEndpoints,
CHANNEL_MENTION_REGEX,
CONTEXT_MENU_COMMANDS_NAME_REGEX, DISCORDENO_VERSION, DISCORD_SNOWFLAKE_REGEX, SLASH_COMMANDS_NAME_REGEX,
USER_AGENT
} from './util/constants.js'
import { iconBigintToHash, iconHashToBigInt } from './util/hash.js'
import { calculateBits, calculatePermissions } from './util/permissions.js'
import { urlToBase64 } from './util/urlToBase64.js'
import { delay, formatImageURL } from './util/utils.js'
import { validateLength } from './util/validateLength.js'
import { CreateShardManager } from './gateway/manager/shardManager.js'
import {
AllowedMentions,
CreateApplicationCommand,
InteractionResponse,
ShardSocketCloseCodes,
transformApplicationCommandOptionChoiceToDiscordApplicationCommandOptionChoice,
transformApplicationCommandOptionToDiscordApplicationCommandOption
} from './mod.js'
import {
ApplicationCommandOptionChoice,
transformApplicationCommandOptionChoice
} from './transformers/applicationCommandOptionChoice.js'
import {
AutoModerationActionExecution,
transformAutoModerationActionExecution
} from './transformers/automodActionExecution.js'
import { AutoModerationRule, transformAutoModerationRule } from './transformers/automodRule.js'
import { transformActivityToDiscordActivity } from './transformers/reverse/activity.js'
import { transformAllowedMentionsToDiscordAllowedMentions } from './transformers/reverse/allowedMentions.js'
import { transformApplicationToDiscordApplication } from './transformers/reverse/application.js'
import { transformComponentToDiscordComponent } from './transformers/reverse/component.js'
import { transformCreateApplicationCommandToDiscordCreateApplicationCommand } from './transformers/reverse/createApplicationCommand.js'
import { transformEmbedToDiscordEmbed } from './transformers/reverse/embed.js'
import { transformInteractionResponseToDiscordInteractionResponse } from './transformers/reverse/interactionResponse.js'
import { transformMemberToDiscordMember, transformUserToDiscordUser } from './transformers/reverse/member.js'
import { transformTeamToDiscordTeam } from './transformers/reverse/team.js'
import { routes } from './util/routes.js'
import { getBotIdFromToken, removeTokenPrefix } from './util/token.js'
InteractionResponse
} from './types.js'
import { routes } from './utils/routes.js'
import { delay, formatImageURL } from './utils/utils.js'
export function createBot (options: CreateBotOptions): Bot {
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions
const bot = {
id: options.botId ?? getBotIdFromToken(options.token),
applicationId: options.applicationId || options.botId || getBotIdFromToken(options.token),
@@ -267,7 +152,7 @@ export function createEventHandlers (
}
}
export async function startBot (bot: Bot) {
export async function startBot (bot: Bot): Promise<void> {
if (Object.keys(bot.botGatewayData ?? {}).length === 0) {
bot.gateway.gatewayBot = await bot.helpers.getGatewayBot()
bot.gateway.lastShardId = bot.gateway.gatewayBot.shards - 1
@@ -277,6 +162,7 @@ export async function startBot (bot: Bot) {
bot.gateway.spawnShards()
}
// eslint-disable-next-line @typescript-eslint/explicit-function-return-type
export function createUtils (options: Partial<HelperUtils>) {
return {
snowflakeToBigint,
@@ -307,7 +193,7 @@ export interface HelperUtils {
calculatePermissions: typeof calculatePermissions
}
export async function stopBot (bot: Bot) {
export async function stopBot (bot: Bot): Promise<Bot> {
await bot.gateway.stop(ShardSocketCloseCodes.Shutdown, 'User requested bot stop')
return bot

View File

@@ -1,5 +1,5 @@
import { DiscordChannel, DiscordGatewayPayload } from '@discordeno/types'
import type { Bot } from '../../bot.js'
import { DiscordChannel, DiscordGatewayPayload } from '../../types/discord.js'
export async function handleChannelCreate (bot: Bot, payload: DiscordGatewayPayload) {
const channel = bot.transformers.channel(bot, { channel: payload.d as DiscordChannel })

View File

@@ -1,5 +1,5 @@
import { DiscordChannel, DiscordGatewayPayload } from '@discordeno/types'
import type { Bot } from '../../bot.js'
import { DiscordChannel, DiscordGatewayPayload } from '../../types/discord.js'
export async function handleChannelDelete (bot: Bot, data: DiscordGatewayPayload) {
const payload = data.d as DiscordChannel

View File

@@ -1,5 +1,5 @@
import { DiscordChannelPinsUpdate, DiscordGatewayPayload } from '@discordeno/types'
import type { Bot } from '../../bot.js'
import { DiscordChannelPinsUpdate, DiscordGatewayPayload } from '../../types/discord.js'
export async function handleChannelPinsUpdate (bot: Bot, data: DiscordGatewayPayload) {
const payload = data.d as DiscordChannelPinsUpdate

View File

@@ -1,5 +1,5 @@
import { DiscordChannel, DiscordGatewayPayload } from '@discordeno/types'
import type { Bot } from '../../bot.js'
import { DiscordChannel, DiscordGatewayPayload } from '../../types/discord.js'
export async function handleChannelUpdate (bot: Bot, data: DiscordGatewayPayload) {
const payload = data.d as DiscordChannel

View File

@@ -1,5 +1,5 @@
import { DiscordGatewayPayload, DiscordStageInstance } from '@discordeno/types'
import type { Bot } from '../../bot.js'
import { DiscordGatewayPayload, DiscordStageInstance } from '../../types/discord.js'
export function handleStageInstanceCreate (bot: Bot, data: DiscordGatewayPayload) {
const payload = data.d as DiscordStageInstance

View File

@@ -1,5 +1,5 @@
import { DiscordGatewayPayload, DiscordStageInstance } from '@discordeno/types'
import type { Bot } from '../../bot.js'
import { DiscordGatewayPayload, DiscordStageInstance } from '../../types/discord.js'
export function handleStageInstanceDelete (bot: Bot, data: DiscordGatewayPayload) {
const payload = data.d as DiscordStageInstance

View File

@@ -1,5 +1,5 @@
import { DiscordGatewayPayload, DiscordStageInstance } from '@discordeno/types'
import type { Bot } from '../../bot.js'
import { DiscordGatewayPayload, DiscordStageInstance } from '../../types/discord.js'
export function handleStageInstanceUpdate (bot: Bot, data: DiscordGatewayPayload) {
const payload = data.d as DiscordStageInstance

View File

@@ -1,5 +1,5 @@
import { DiscordChannel, DiscordGatewayPayload } from '@discordeno/types'
import { Bot } from '../../bot.js'
import { DiscordChannel, DiscordGatewayPayload } from '../../types/discord.js'
export async function handleThreadCreate (bot: Bot, data: DiscordGatewayPayload) {
const payload = data.d as DiscordChannel

View File

@@ -1,5 +1,5 @@
import { DiscordChannel, DiscordGatewayPayload } from '@discordeno/types'
import { Bot } from '../../bot.js'
import { DiscordChannel, DiscordGatewayPayload } from '../../types/discord.js'
export async function handleThreadDelete (bot: Bot, data: DiscordGatewayPayload) {
const payload = data.d as DiscordChannel

View File

@@ -1,5 +1,5 @@
import { DiscordGatewayPayload, DiscordThreadListSync } from '@discordeno/types'
import { Bot } from '../../bot.js'
import { DiscordGatewayPayload, DiscordThreadListSync } from '../../types/discord.js'
export async function handleThreadListSync (bot: Bot, data: DiscordGatewayPayload) {
const payload = data.d as DiscordThreadListSync

View File

@@ -1,5 +1,5 @@
import { DiscordGatewayPayload, DiscordThreadMembersUpdate } from '@discordeno/types'
import { Bot } from '../../bot.js'
import { DiscordGatewayPayload, DiscordThreadMembersUpdate } from '../../types/discord.js'
export async function handleThreadMembersUpdate (bot: Bot, data: DiscordGatewayPayload) {
const payload = data.d as DiscordThreadMembersUpdate

View File

@@ -1,5 +1,5 @@
import { DiscordGatewayPayload, DiscordThreadMemberUpdate } from '@discordeno/types'
import { Bot } from '../../bot.js'
import { DiscordGatewayPayload, DiscordThreadMemberUpdate } from '../../types/discord.js'
export async function handleThreadMemberUpdate (bot: Bot, data: DiscordGatewayPayload) {
const payload = data.d as DiscordThreadMemberUpdate

View File

@@ -1,5 +1,5 @@
import { DiscordChannel, DiscordGatewayPayload } from '@discordeno/types'
import { Bot } from '../../bot.js'
import { DiscordChannel, DiscordGatewayPayload } from '../../types/discord.js'
export async function handleThreadUpdate (bot: Bot, data: DiscordGatewayPayload) {
const payload = data.d as DiscordChannel

View File

@@ -1,5 +1,5 @@
import { DiscordGatewayPayload, DiscordGuildEmojisUpdate } from '@discordeno/types'
import type { Bot } from '../../bot.js'
import { DiscordGatewayPayload, DiscordGuildEmojisUpdate } from '../../types/discord.js'
import { Collection } from '../../util/collection.js'
export async function handleGuildEmojisUpdate (bot: Bot, data: DiscordGatewayPayload) {

View File

@@ -1,5 +1,5 @@
import { DiscordGatewayPayload, DiscordGuildBanAddRemove } from '@discordeno/types'
import type { Bot } from '../../bot.js'
import { DiscordGatewayPayload, DiscordGuildBanAddRemove } from '../../types/discord.js'
export async function handleGuildBanAdd (bot: Bot, data: DiscordGatewayPayload) {
const payload = data.d as DiscordGuildBanAddRemove

View File

@@ -1,5 +1,5 @@
import { DiscordGatewayPayload, DiscordGuildBanAddRemove } from '@discordeno/types'
import type { Bot } from '../../bot.js'
import { DiscordGatewayPayload, DiscordGuildBanAddRemove } from '../../types/discord.js'
export async function handleGuildBanRemove (bot: Bot, data: DiscordGatewayPayload) {
const payload = data.d as DiscordGuildBanAddRemove

View File

@@ -1,5 +1,5 @@
import { DiscordGatewayPayload, DiscordGuild } from '@discordeno/types'
import type { Bot } from '../../bot.js'
import { DiscordGatewayPayload, DiscordGuild } from '../../types/discord.js'
export function handleGuildCreate (bot: Bot, data: DiscordGatewayPayload, shardId: number) {
const payload = data.d as DiscordGuild

View File

@@ -1,5 +1,5 @@
import { DiscordGatewayPayload, DiscordUnavailableGuild } from '@discordeno/types'
import type { Bot } from '../../bot.js'
import { DiscordGatewayPayload, DiscordUnavailableGuild } from '../../types/discord.js'
export async function handleGuildDelete (bot: Bot, data: DiscordGatewayPayload, shardId: number) {
const payload = data.d as DiscordUnavailableGuild

View File

@@ -1,5 +1,5 @@
import { DiscordGatewayPayload, DiscordGuildIntegrationsUpdate } from '@discordeno/types'
import type { Bot } from '../../bot.js'
import { DiscordGatewayPayload, DiscordGuildIntegrationsUpdate } from '../../types/discord.js'
export async function handleGuildIntegrationsUpdate (bot: Bot, data: DiscordGatewayPayload) {
const payload = data.d as DiscordGuildIntegrationsUpdate

View File

@@ -1,5 +1,5 @@
import { DiscordGatewayPayload, DiscordGuild } from '@discordeno/types'
import type { Bot } from '../../bot.js'
import { DiscordGatewayPayload, DiscordGuild } from '../../types/discord.js'
export function handleGuildUpdate (bot: Bot, data: DiscordGatewayPayload, shardId: number) {
const payload = data.d as DiscordGuild

View File

@@ -4,4 +4,4 @@ export * from './GUILD_CREATE.js'
export * from './GUILD_DELETE.js'
export * from './GUILD_INTEGRATIONS_UPDATE.js'
export * from './GUILD_UPDATE.js'
export * from './scheduledEvents/mod.js'
export * from './scheduledEvents/index.js'

View File

@@ -1,5 +1,5 @@
import { DiscordGatewayPayload, DiscordScheduledEvent } from '@discordeno/types'
import type { Bot } from '../../../bot.js'
import { DiscordGatewayPayload, DiscordScheduledEvent } from '../../../types/discord.js'
export function handleGuildScheduledEventCreate (bot: Bot, data: DiscordGatewayPayload, shardId: number) {
const payload = data.d as DiscordScheduledEvent

View File

@@ -1,5 +1,5 @@
import { DiscordGatewayPayload, DiscordScheduledEvent } from '@discordeno/types'
import type { Bot } from '../../../bot.js'
import { DiscordGatewayPayload, DiscordScheduledEvent } from '../../../types/discord.js'
export function handleGuildScheduledEventDelete (bot: Bot, data: DiscordGatewayPayload) {
const payload = data.d as DiscordScheduledEvent

View File

@@ -1,5 +1,5 @@
import { DiscordGatewayPayload, DiscordScheduledEvent } from '@discordeno/types'
import type { Bot } from '../../../bot.js'
import { DiscordGatewayPayload, DiscordScheduledEvent } from '../../../types/discord.js'
export function handleGuildScheduledEventUpdate (bot: Bot, data: DiscordGatewayPayload) {
const payload = data.d as DiscordScheduledEvent

View File

@@ -1,5 +1,5 @@
import { DiscordGatewayPayload, DiscordScheduledEventUserAdd } from '@discordeno/types'
import type { Bot } from '../../../bot.js'
import { DiscordGatewayPayload, DiscordScheduledEventUserAdd } from '../../../types/discord.js'
export function handleGuildScheduledEventUserAdd (bot: Bot, data: DiscordGatewayPayload) {
const payload = data.d as DiscordScheduledEventUserAdd

View File

@@ -1,5 +1,5 @@
import { DiscordGatewayPayload, DiscordScheduledEventUserRemove } from '@discordeno/types'
import type { Bot } from '../../../bot.js'
import { DiscordGatewayPayload, DiscordScheduledEventUserRemove } from '../../../types/discord.js'
export function handleGuildScheduledEventUserRemove (bot: Bot, data: DiscordGatewayPayload) {
const payload = data.d as DiscordScheduledEventUserRemove

View File

@@ -0,0 +1,12 @@
export * from './channels/index.js'
export * from './emojis/index.js'
export * from './guilds/index.js'
export * from './integrations/index.js'
export * from './interactions/index.js'
export * from './invites/index.js'
export * from './members/index.js'
export * from './messages/index.js'
export * from './misc/index.js'
export * from './roles/index.js'
export * from './voice/index.js'
export * from './webhooks/index.js'

View File

@@ -1,5 +1,5 @@
import { DiscordGatewayPayload, DiscordIntegrationCreateUpdate } from '@discordeno/types'
import { Bot } from '../../bot.js'
import { DiscordGatewayPayload, DiscordIntegrationCreateUpdate } from '../../types/discord.js'
export function handleIntegrationCreate (bot: Bot, data: DiscordGatewayPayload) {
bot.events.integrationCreate(

View File

@@ -1,5 +1,5 @@
import { DiscordGatewayPayload, DiscordIntegrationDelete } from '@discordeno/types'
import { Bot } from '../../bot.js'
import { DiscordGatewayPayload, DiscordIntegrationDelete } from '../../types/discord.js'
export function handleIntegrationDelete (bot: Bot, data: DiscordGatewayPayload) {
const payload = data.d as DiscordIntegrationDelete

View File

@@ -1,5 +1,5 @@
import { DiscordGatewayPayload, DiscordIntegrationCreateUpdate } from '@discordeno/types'
import { Bot } from '../../bot.js'
import { DiscordGatewayPayload, DiscordIntegrationCreateUpdate } from '../../types/discord.js'
export function handleIntegrationUpdate (bot: Bot, data: DiscordGatewayPayload) {
bot.events.integrationUpdate(

View File

@@ -1,5 +1,5 @@
import { DiscordGatewayPayload, DiscordInteraction } from '@discordeno/types'
import { Bot } from '../../bot.js'
import { DiscordGatewayPayload, DiscordInteraction } from '../../types/discord.js'
export async function handleInteractionCreate (bot: Bot, data: DiscordGatewayPayload) {
bot.cache.unrepliedInteractions.add(bot.transformers.snowflake((data.d as DiscordInteraction).id))

View File

@@ -1,5 +1,5 @@
import { DiscordGatewayPayload, DiscordInviteCreate } from '@discordeno/types'
import { Bot } from '../../bot.js'
import { DiscordGatewayPayload, DiscordInviteCreate } from '../../types/discord.js'
export function handleInviteCreate (bot: Bot, data: DiscordGatewayPayload) {
bot.events.inviteCreate(bot, bot.transformers.invite(bot, data.d as DiscordInviteCreate))

View File

@@ -1,5 +1,5 @@
import { DiscordGatewayPayload, DiscordInviteDelete } from '@discordeno/types'
import { Bot } from '../../bot.js'
import { DiscordGatewayPayload, DiscordInviteDelete } from '../../types/discord.js'
export function handleInviteDelete (bot: Bot, data: DiscordGatewayPayload) {
const payload = data.d as DiscordInviteDelete

View File

@@ -1,6 +1,5 @@
import { DiscordGatewayPayload, DiscordGuildMembersChunk, PresenceStatus } from '@discordeno/types'
import { Bot } from '../../bot.js'
import { DiscordGatewayPayload, DiscordGuildMembersChunk } from '../../types/discord.js'
import { PresenceStatus } from '../../types/shared.js'
export async function handleGuildMembersChunk (bot: Bot, data: DiscordGatewayPayload) {
const payload = data.d as DiscordGuildMembersChunk

View File

@@ -1,5 +1,5 @@
import { DiscordGatewayPayload, DiscordGuildMemberAdd } from '@discordeno/types'
import { Bot } from '../../bot.js'
import { DiscordGatewayPayload, DiscordGuildMemberAdd } from '../../types/discord.js'
export async function handleGuildMemberAdd (bot: Bot, data: DiscordGatewayPayload) {
const payload = data.d as DiscordGuildMemberAdd

View File

@@ -1,5 +1,5 @@
import { DiscordGatewayPayload, DiscordGuildMemberRemove } from '@discordeno/types'
import { Bot } from '../../bot.js'
import { DiscordGatewayPayload, DiscordGuildMemberRemove } from '../../types/discord.js'
export async function handleGuildMemberRemove (bot: Bot, data: DiscordGatewayPayload) {
const payload = data.d as DiscordGuildMemberRemove

View File

@@ -1,5 +1,5 @@
import { DiscordGatewayPayload, DiscordGuildMemberUpdate } from '@discordeno/types'
import { Bot } from '../../bot.js'
import { DiscordGatewayPayload, DiscordGuildMemberUpdate } from '../../types/discord.js'
export async function handleGuildMemberUpdate (bot: Bot, data: DiscordGatewayPayload) {
const payload = data.d as DiscordGuildMemberUpdate

View File

@@ -1,5 +1,5 @@
import { DiscordGatewayPayload, DiscordMessage } from '@discordeno/types'
import { Bot } from '../../bot.js'
import { DiscordGatewayPayload, DiscordMessage } from '../../types/discord.js'
export async function handleMessageCreate (bot: Bot, data: DiscordGatewayPayload) {
const payload = data.d as DiscordMessage

View File

@@ -1,5 +1,5 @@
import { DiscordGatewayPayload, DiscordMessageDelete } from '@discordeno/types'
import { Bot } from '../../bot.js'
import { DiscordGatewayPayload, DiscordMessageDelete } from '../../types/discord.js'
export async function handleMessageDelete (bot: Bot, data: DiscordGatewayPayload) {
const payload = data.d as DiscordMessageDelete

View File

@@ -1,5 +1,5 @@
import { DiscordGatewayPayload, DiscordMessageDeleteBulk } from '@discordeno/types'
import { Bot } from '../../bot.js'
import { DiscordGatewayPayload, DiscordMessageDeleteBulk } from '../../types/discord.js'
export async function handleMessageDeleteBulk (bot: Bot, data: DiscordGatewayPayload) {
const payload = data.d as DiscordMessageDeleteBulk

View File

@@ -1,5 +1,5 @@
import { DiscordGatewayPayload, DiscordMessageReactionAdd } from '@discordeno/types'
import { Bot } from '../../bot.js'
import { DiscordGatewayPayload, DiscordMessageReactionAdd } from '../../types/discord.js'
export async function handleMessageReactionAdd (bot: Bot, data: DiscordGatewayPayload) {
const payload = data.d as DiscordMessageReactionAdd

View File

@@ -1,5 +1,5 @@
import { DiscordGatewayPayload, DiscordMessageReactionRemove } from '@discordeno/types'
import { Bot } from '../../bot.js'
import { DiscordGatewayPayload, DiscordMessageReactionRemove } from '../../types/discord.js'
export async function handleMessageReactionRemove (bot: Bot, data: DiscordGatewayPayload) {
const payload = data.d as DiscordMessageReactionRemove

View File

@@ -1,5 +1,5 @@
import { DiscordGatewayPayload, DiscordMessageReactionRemoveAll } from '@discordeno/types'
import { Bot } from '../../bot.js'
import { DiscordGatewayPayload, DiscordMessageReactionRemoveAll } from '../../types/discord.js'
export async function handleMessageReactionRemoveAll (bot: Bot, data: DiscordGatewayPayload) {
const payload = data.d as DiscordMessageReactionRemoveAll

View File

@@ -1,5 +1,5 @@
import { DiscordGatewayPayload, DiscordMessageReactionRemoveEmoji } from '@discordeno/types'
import { Bot } from '../../bot.js'
import { DiscordGatewayPayload, DiscordMessageReactionRemoveEmoji } from '../../types/discord.js'
export async function handleMessageReactionRemoveEmoji (bot: Bot, data: DiscordGatewayPayload) {
const payload = data.d as DiscordMessageReactionRemoveEmoji

View File

@@ -1,5 +1,5 @@
import { DiscordGatewayPayload, DiscordMessage } from '@discordeno/types'
import { Bot } from '../../bot.js'
import { DiscordGatewayPayload, DiscordMessage } from '../../types/discord.js'
export async function handleMessageUpdate (bot: Bot, data: DiscordGatewayPayload) {
const payload = data.d as DiscordMessage

View File

@@ -1,5 +1,5 @@
import { DiscordGatewayPayload, DiscordPresenceUpdate } from '@discordeno/types'
import { Bot } from '../../bot.js'
import { DiscordGatewayPayload, DiscordPresenceUpdate } from '../../types/discord.js'
export async function handlePresenceUpdate (bot: Bot, data: DiscordGatewayPayload) {
bot.events.presenceUpdate(bot, bot.transformers.presence(bot, data.d as DiscordPresenceUpdate))

View File

@@ -1,5 +1,5 @@
import { DiscordGatewayPayload, DiscordReady } from '@discordeno/types'
import { Bot } from '../../bot.js'
import { DiscordGatewayPayload, DiscordReady } from '../../types/discord.js'
export function handleReady (bot: Bot, data: DiscordGatewayPayload, shardId: number) {
const payload = data.d as DiscordReady

View File

@@ -1,5 +1,5 @@
import { DiscordGatewayPayload, DiscordTypingStart } from '@discordeno/types'
import { Bot } from '../../bot.js'
import { DiscordGatewayPayload, DiscordTypingStart } from '../../types/discord.js'
export function handleTypingStart (bot: Bot, data: DiscordGatewayPayload) {
const payload = data.d as DiscordTypingStart

View File

@@ -1,5 +1,5 @@
import { DiscordGatewayPayload, DiscordUser } from '@discordeno/types'
import { Bot } from '../../bot.js'
import { DiscordGatewayPayload, DiscordUser } from '../../types/discord.js'
export async function handleUserUpdate (bot: Bot, data: DiscordGatewayPayload) {
const payload = data.d as DiscordUser

View File

@@ -1,12 +0,0 @@
export * from './channels/mod.js'
export * from './emojis/mod.js'
export * from './guilds/mod.js'
export * from './integrations/mod.js'
export * from './interactions/mod.js'
export * from './invites/mod.js'
export * from './members/mod.js'
export * from './messages/mod.js'
export * from './misc/mod.js'
export * from './roles/mod.js'
export * from './voice/mod.js'
export * from './webhooks/mod.js'

View File

@@ -1,5 +1,5 @@
import { DiscordGatewayPayload, DiscordGuildRoleCreate } from '@discordeno/types'
import { Bot } from '../../bot.js'
import { DiscordGatewayPayload, DiscordGuildRoleCreate } from '../../types/discord.js'
export async function handleGuildRoleCreate (bot: Bot, data: DiscordGatewayPayload) {
const payload = data.d as DiscordGuildRoleCreate

View File

@@ -1,5 +1,5 @@
import { DiscordGatewayPayload, DiscordGuildRoleDelete } from '@discordeno/types'
import { Bot } from '../../bot.js'
import { DiscordGatewayPayload, DiscordGuildRoleDelete } from '../../types/discord.js'
export async function handleGuildRoleDelete (bot: Bot, data: DiscordGatewayPayload) {
const payload = data.d as DiscordGuildRoleDelete

View File

@@ -1,5 +1,5 @@
import { DiscordGatewayPayload, DiscordGuildRoleUpdate } from '@discordeno/types'
import { Bot } from '../../bot.js'
import { DiscordGatewayPayload, DiscordGuildRoleUpdate } from '../../types/discord.js'
export async function handleGuildRoleUpdate (bot: Bot, data: DiscordGatewayPayload) {
const payload = data.d as DiscordGuildRoleUpdate

View File

@@ -1,5 +1,5 @@
import { DiscordGatewayPayload, DiscordVoiceServerUpdate } from '@discordeno/types'
import { Bot } from '../../bot.js'
import { DiscordGatewayPayload, DiscordVoiceServerUpdate } from '../../types/discord.js'
export async function handleVoiceServerUpdate (bot: Bot, data: DiscordGatewayPayload) {
const payload = data.d as DiscordVoiceServerUpdate

View File

@@ -1,5 +1,5 @@
import { DiscordGatewayPayload, DiscordVoiceState } from '@discordeno/types'
import { Bot } from '../../bot.js'
import { DiscordGatewayPayload, DiscordVoiceState } from '../../types/discord.js'
export async function handleVoiceStateUpdate (bot: Bot, data: DiscordGatewayPayload) {
const payload = data.d as DiscordVoiceState

View File

@@ -1,5 +1,5 @@
import { DiscordGatewayPayload, DiscordWebhookUpdate } from '@discordeno/types'
import { Bot } from '../../bot.js'
import { DiscordGatewayPayload, DiscordWebhookUpdate } from '../../types/discord.js'
export function handleWebhooksUpdate (bot: Bot, data: DiscordGatewayPayload) {
const payload = data.d as DiscordWebhookUpdate

View File

@@ -1,5 +1,5 @@
import { DiscordFollowedChannel } from '@discordeno/types'
import type { Bot } from '../../../bot.js'
import { DiscordFollowedChannel } from '../../../types/discord.js'
import { BigString } from '../../../types/shared.js'
/**

View File

@@ -1,9 +1,7 @@
import { BigString, ChannelTypes, DiscordChannel, OverwriteReadable, SortOrderTypes } from '@discordeno/types'
import type { Bot } from '../../bot.js'
import { WithReason } from '../../mod.js'
import { WithReason } from '../../index.js'
import { Channel } from '../../transformers/channel.js'
import { DiscordChannel } from '../../types/discord.js'
import { OverwriteReadable } from '../../types/discordeno.js'
import { BigString, ChannelTypes, SortOrderTypes } from '../../types/shared.js'
/**
* Creates a channel within a guild.

View File

@@ -1,5 +1,5 @@
import { BigString } from '@discordeno/types'
import type { Bot } from '../../bot.js'
import { BigString } from '../../types/shared.js'
/**
* Deletes a channel from within a guild.

View File

@@ -1,5 +1,5 @@
import { BigString } from '@discordeno/types'
import type { Bot } from '../../bot.js'
import { BigString } from '../../types/shared.js'
/**
* Deletes a permission override for a user or role in a channel.

View File

@@ -1,9 +1,7 @@
import { BigString, ChannelTypes, DiscordChannel, OverwriteReadable, SortOrderTypes, VideoQualityModes } from '@discordeno/types'
import type { Bot } from '../../bot.js'
import { WithReason } from '../../mod.js'
import { WithReason } from '../../index.js'
import { Channel } from '../../transformers/channel.js'
import { DiscordChannel } from '../../types/discord.js'
import { OverwriteReadable } from '../../types/discordeno.js'
import { BigString, ChannelTypes, SortOrderTypes, VideoQualityModes } from '../../types/shared.js'
/**
* Edits a channel's settings.

View File

@@ -1,6 +1,6 @@
import { OverwriteReadable } from '@discordeno/types'
import type { Bot } from '../../bot.js'
import { BigString, WithReason } from '../../mod.js'
import { OverwriteReadable } from '../../types/discordeno.js'
import { BigString, WithReason } from '../../index.js'
/**
* Edits the permission overrides for a user or role in a channel.

View File

@@ -1,5 +1,5 @@
import { BigString } from '@discordeno/types'
import type { Bot } from '../../bot.js'
import { BigString } from '../../types/shared.js'
export const swapChannels = editChannelPositions

View File

@@ -1,8 +1,8 @@
import { DiscordChannel } from '@discordeno/types'
import type { Bot } from '../../../bot.js'
import { Channel } from '../../../transformers/channel.js'
import { Embed } from '../../../transformers/embed.js'
import { DiscordChannel } from '../../../types/discord.js'
import { AllowedMentions, BigString, FileContent, MessageComponents, WithReason } from '../../../types/mod.js'
import { AllowedMentions, BigString, FileContent, MessageComponents, WithReason } from '../../../types/index.js'
/**
* Creates a new thread in a forum channel, and sends a message within the created thread.

View File

@@ -1,7 +1,6 @@
import { BigString, DiscordChannel } from '@discordeno/types'
import type { Bot } from '../../bot.js'
import { Channel } from '../../transformers/channel.js'
import { DiscordChannel } from '../../types/discord.js'
import { BigString } from '../../types/shared.js'
/**
* Gets a channel by its ID.

View File

@@ -1,8 +1,7 @@
import { BigString, DiscordInviteMetadata, TargetTypes } from '@discordeno/types'
import type { Bot } from '../../bot.js'
import { DiscordInviteMetadata } from '../../types/discord.js'
import { BigString, TargetTypes } from '../../types/shared.js'
import { Collection } from '../../util/collection.js'
import { InviteMetadata } from '../guilds/invites/mod.js'
import { InviteMetadata } from '../guilds/invites/index.js'
/**
* Gets the list of invites for a channel.

View File

@@ -1,7 +1,6 @@
import { BigString, DiscordChannel } from '@discordeno/types'
import type { Bot } from '../../bot.js'
import { Channel } from '../../transformers/channel.js'
import { DiscordChannel } from '../../types/discord.js'
import { BigString } from '../../types/shared.js'
import { Collection } from '../../util/collection.js'
/**

View File

@@ -1,14 +1,14 @@
export * from './announcements/mod.js'
export * from './announcements/index.js'
export * from './createChannel.js'
export * from './deleteChannel.js'
export * from './deleteChannelPermissionOverride.js'
export * from './editChannel.js'
export * from './editChannelPermissionOverrides.js'
export * from './editChannelPositions.js'
export * from './forums/mod.js'
export * from './forums/index.js'
export * from './getChannel.js'
export * from './getChannelInvites.js'
export * from './getChannels.js'
export * from './stages/mod.js'
export * from './threads/mod.js'
export * from './stages/index.js'
export * from './threads/index.js'
export * from './triggerTypingIndicator.js'

View File

@@ -1,7 +1,7 @@
import { DiscordStageInstance } from '@discordeno/types'
import type { Bot } from '../../../bot.js'
import { BigString, WithReason } from '../../../mod.js'
import { BigString, WithReason } from '../../../index.js'
import { StageInstance } from '../../../transformers/stageInstance.js'
import { DiscordStageInstance } from '../../../types/discord.js'
/**
* Creates a stage instance associated with a stage channel.

View File

@@ -1,7 +1,7 @@
import { DiscordStageInstance } from '@discordeno/types'
import type { Bot } from '../../../bot.js'
import { BigString, WithReason } from '../../../mod.js'
import { BigString, WithReason } from '../../../index.js'
import { StageInstance } from '../../../transformers/stageInstance.js'
import { DiscordStageInstance } from '../../../types/discord.js'
/**
* Edits a stage instance.

View File

@@ -1,6 +1,6 @@
import { DiscordStageInstance } from '@discordeno/types'
import type { Bot } from '../../../bot.js'
import { StageInstance } from '../../../transformers/stageInstance.js'
import { DiscordStageInstance } from '../../../types/discord.js'
import { BigString } from '../../../types/shared.js'
/**

View File

@@ -1,6 +1,6 @@
import { DiscordListActiveThreads } from '@discordeno/types'
import type { Bot } from '../../../bot.js'
import { BigString, Channel, ThreadMember } from '../../../mod.js'
import { DiscordListActiveThreads } from '../../../types/discord.js'
import { BigString, Channel, ThreadMember } from '../../../index.js'
import { Collection } from '../../../util/collection.js'
/**

View File

@@ -1,5 +1,5 @@
import { DiscordListArchivedThreads } from '@discordeno/types'
import type { Bot } from '../../../bot.js'
import { DiscordListArchivedThreads } from '../../../types/discord.js'
import { BigString } from '../../../types/shared.js'
import { Collection } from '../../../util/collection.js'
import { ArchivedThreads, ListArchivedThreads } from './getPublicArchivedThreads.js'

View File

@@ -1,5 +1,5 @@
import { DiscordListArchivedThreads } from '@discordeno/types'
import type { Bot } from '../../../bot.js'
import { DiscordListArchivedThreads } from '../../../types/discord.js'
import { BigString } from '../../../types/shared.js'
import { Collection } from '../../../util/collection.js'
import { ArchivedThreads, ListArchivedThreads } from './getPublicArchivedThreads.js'

View File

@@ -1,5 +1,5 @@
import { DiscordListArchivedThreads } from '@discordeno/types'
import type { Bot } from '../../../bot.js'
import { DiscordListArchivedThreads } from '../../../types/discord.js'
import { BigString } from '../../../types/shared.js'
import { Collection } from '../../../util/collection.js'
import { ActiveThreads } from './getActiveThreads.js'

View File

@@ -1,6 +1,6 @@
import { DiscordThreadMember } from '@discordeno/types'
import type { Bot } from '../../../bot.js'
import { ThreadMember } from '../../../transformers/threadMember.js'
import { DiscordThreadMember } from '../../../types/discord.js'
import { BigString } from '../../../types/shared.js'
/**

View File

@@ -1,6 +1,6 @@
import { DiscordThreadMember } from '@discordeno/types'
import type { Bot } from '../../../bot.js'
import { ThreadMember } from '../../../transformers/threadMember.js'
import { DiscordThreadMember } from '../../../types/discord.js'
import { BigString } from '../../../types/shared.js'
import { Collection } from '../../../util/collection.js'

View File

@@ -1,7 +1,7 @@
import { DiscordChannel } from '@discordeno/types'
import type { Bot } from '../../../bot.js'
import { BigString, WithReason } from '../../../mod.js'
import { BigString, WithReason } from '../../../index.js'
import { Channel } from '../../../transformers/channel.js'
import { DiscordChannel } from '../../../types/discord.js'
/**
* Creates a thread, using an existing message as its point of origin.

View File

@@ -1,7 +1,7 @@
import { DiscordChannel } from '@discordeno/types'
import type { Bot } from '../../../bot.js'
import { WithReason } from '../../../mod.js'
import { WithReason } from '../../../index.js'
import { Channel } from '../../../transformers/channel.js'
import { DiscordChannel } from '../../../types/discord.js'
import { BigString, ChannelTypes } from '../../../types/shared.js'
/**

View File

@@ -1,5 +1,5 @@
import { BigString } from '@discordeno/types'
import type { Bot } from '../../bot.js'
import { BigString } from '../../types/shared.js'
export const startTyping = triggerTypingIndicator

View File

@@ -1,7 +1,7 @@
import { DiscordEmoji } from '@discordeno/types'
import type { Bot } from '../../bot.js'
import { BigString, WithReason } from '../../mod.js'
import { BigString, WithReason } from '../../index.js'
import { Emoji } from '../../transformers/emoji.js'
import { DiscordEmoji } from '../../types/discord.js'
/**
* Creates an emoji in a guild.

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