mirror of
https://github.com/discordeno/discordeno.git
synced 2026-06-03 01:10:07 +00:00
feat: base plugin lib idea (#2308)
* feat: base plugin lib idea * fix: stuff * fmt * fix: imports and exports * fix: errors & tests * fix: remove logs
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { GatewayManager } from "../gateway/manager/gatewayManager.ts";
|
||||
import { GatewayManager } from "./manager/gatewayManager.ts";
|
||||
|
||||
export function calculateShardId(gateway: GatewayManager, guildId: bigint) {
|
||||
if (gateway.manager.totalShards === 1) return 0;
|
||||
@@ -1,8 +1,6 @@
|
||||
import { GetGatewayBot } from "../../transformers/gatewayBot.ts";
|
||||
import { DiscordGatewayPayload } from "../../types/discord.ts";
|
||||
import { GatewayIntents, MakeRequired, OmitFirstFnArg, PickPartial } from "../../types/shared.ts";
|
||||
import { GatewayBot, PickPartial } from "../../types/shared.ts";
|
||||
import { LeakyBucket } from "../../util/bucket.ts";
|
||||
import { Collection } from "../../util/collection.ts";
|
||||
import { CreateShard, createShard } from "../shard/createShard.ts";
|
||||
import { Shard, ShardGatewayConfig } from "../shard/types.ts";
|
||||
import { calculateTotalShards } from "./calculateTotalShards.ts";
|
||||
@@ -48,7 +46,7 @@ export function createGatewayManager(
|
||||
/** The max concurrency buckets.
|
||||
* Those will be created when the `spawnShards` (which calls `prepareBuckets` under the hood) function gets called.
|
||||
*/
|
||||
buckets: new Collection<
|
||||
buckets: new Map<
|
||||
number,
|
||||
{
|
||||
workers: { id: number; queue: number[] }[];
|
||||
@@ -222,7 +220,7 @@ export interface CreateGatewayManager {
|
||||
lastShardId: number;
|
||||
|
||||
/** Important data which is used by the manager to connect shards to the gateway. */
|
||||
gatewayBot: GetGatewayBot;
|
||||
gatewayBot: GatewayBot;
|
||||
|
||||
gatewayConfig: PickPartial<ShardGatewayConfig, "token">;
|
||||
|
||||
@@ -230,7 +228,7 @@ export interface CreateGatewayManager {
|
||||
createShardOptions?: Omit<CreateShard, "id" | "totalShards" | "requestIdentify" | "gatewayConfig">;
|
||||
|
||||
/** Stored as bucketId: { workers: [workerId, [ShardIds]], createNextShard: boolean } */
|
||||
buckets: Collection<
|
||||
buckets: Map<
|
||||
number,
|
||||
{
|
||||
workers: { id: number; queue: number[] }[];
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { delay } from "../../util/utils.ts";
|
||||
import { delay } from "../../util/delay.ts";
|
||||
import { GatewayManager } from "./gatewayManager.ts";
|
||||
|
||||
export async function stop(gateway: GatewayManager, code: number, reason: string) {
|
||||
|
||||
@@ -12,7 +12,6 @@ import {
|
||||
ShardSocketRequest,
|
||||
ShardState,
|
||||
} from "./types.ts";
|
||||
import { StatusUpdate } from "../../helpers/misc/editShardStatus.ts";
|
||||
import { startHeartbeating } from "./startHeartbeating.ts";
|
||||
import { stopHeartbeating } from "./stopHeartbeating.ts";
|
||||
import { resume } from "./resume.ts";
|
||||
@@ -24,7 +23,7 @@ import { connect } from "./connect.ts";
|
||||
import { close } from "./close.ts";
|
||||
import { shutdown } from "./shutdown.ts";
|
||||
import { isOpen } from "./isOpen.ts";
|
||||
import { DiscordGatewayPayload } from "../../types/discord.ts";
|
||||
import { DiscordGatewayPayload, DiscordStatusUpdate } from "../../types/discord.ts";
|
||||
import { GatewayIntents, PickPartial } from "../../types/shared.ts";
|
||||
import { API_VERSION } from "../../util/constants.ts";
|
||||
|
||||
@@ -275,7 +274,7 @@ export interface CreateShard {
|
||||
isOpen?: typeof isOpen;
|
||||
|
||||
/** Function which can be overwritten in order to get the shards presence. */
|
||||
makePresence?(shardId: number): Promise<StatusUpdate> | StatusUpdate;
|
||||
makePresence?(shardId: number): Promise<DiscordStatusUpdate> | DiscordStatusUpdate;
|
||||
|
||||
/** The maximum of requests which can be send to discord per rate limit tick.
|
||||
* Typically this value should not be changed.
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { DiscordGatewayPayload, DiscordHello, DiscordReady } from "../../types/discord.ts";
|
||||
import { GatewayOpcodes } from "../../types/shared.ts";
|
||||
import { createLeakyBucket } from "../../util/bucket.ts";
|
||||
import { delay } from "../../util/utils.ts";
|
||||
import { delay } from "../../util/delay.ts";
|
||||
import { decompressWith } from "./deps.ts";
|
||||
import { GATEWAY_RATE_LIMIT_RESET_INTERVAL, Shard, ShardState } from "./types.ts";
|
||||
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
import { StatusUpdate } from "../../helpers/misc/editShardStatus.ts";
|
||||
import { DiscordGatewayPayload } from "../../types/discord.ts";
|
||||
import { GatewayOpcodes } from "../../types/shared.ts";
|
||||
import { LeakyBucket } from "../../util/bucket.ts";
|
||||
import { createShard } from "./createShard.ts";
|
||||
|
||||
// TODO: think whether we also need an identifiedShard function
|
||||
|
||||
5
mod.ts
5
mod.ts
@@ -1,9 +1,4 @@
|
||||
export * from "./gateway/mod.ts";
|
||||
export * from "./handlers/mod.ts";
|
||||
export * from "./helpers/mod.ts";
|
||||
export * from "./rest/mod.ts";
|
||||
export * from "./transformers/mod.ts";
|
||||
export * from "./types/mod.ts";
|
||||
export * from "./util/mod.ts";
|
||||
|
||||
export * from "./bot.ts";
|
||||
|
||||
@@ -1,97 +1,32 @@
|
||||
import { createRestManager, CreateRestManagerOptions } from "./rest/mod.ts";
|
||||
import { bigintToSnowflake, snowflakeToBigint } from "./util/bigint.ts";
|
||||
import { Collection } from "./util/collection.ts";
|
||||
import {
|
||||
Channel,
|
||||
Guild,
|
||||
Member,
|
||||
Message,
|
||||
Role,
|
||||
ScheduledEvent,
|
||||
Template,
|
||||
transformChannel,
|
||||
transformGuild,
|
||||
transformMember,
|
||||
transformMessage,
|
||||
transformRole,
|
||||
transformTemplate,
|
||||
transformUser,
|
||||
transformVoiceState,
|
||||
User,
|
||||
VoiceState,
|
||||
} from "./transformers/mod.ts";
|
||||
import * as handlers from "./handlers/mod.ts";
|
||||
import * as helpers from "./helpers/mod.ts";
|
||||
import { calculateShardId } from "../../gateway/calculateShardId.ts";
|
||||
import {
|
||||
baseEndpoints,
|
||||
CHANNEL_MENTION_REGEX,
|
||||
CONTEXT_MENU_COMMANDS_NAME_REGEX,
|
||||
createGatewayManager,
|
||||
createRestManager,
|
||||
CreateRestManagerOptions,
|
||||
CreateShardManager,
|
||||
delay,
|
||||
DISCORD_SNOWFLAKE_REGEX,
|
||||
DISCORDENO_VERSION,
|
||||
SLASH_COMMANDS_NAME_REGEX,
|
||||
USER_AGENT,
|
||||
} from "./util/constants.ts";
|
||||
import { createGatewayManager, GatewayManager } from "./gateway/manager/gatewayManager.ts";
|
||||
import { validateLength } from "./util/validateLength.ts";
|
||||
import { delay, formatImageURL } from "./util/utils.ts";
|
||||
import { iconBigintToHash, iconHashToBigInt } from "./util/hash.ts";
|
||||
import { calculateShardId } from "./util/calculateShardId.ts";
|
||||
import * as handlers from "./handlers/mod.ts";
|
||||
import {
|
||||
Interaction,
|
||||
InteractionDataOption,
|
||||
transformInteraction,
|
||||
transformInteractionDataOption,
|
||||
} from "./transformers/interaction.ts";
|
||||
import { Integration, transformIntegration } from "./transformers/integration.ts";
|
||||
import { transformApplication } from "./transformers/application.ts";
|
||||
import { transformTeam } from "./transformers/team.ts";
|
||||
import { Invite, transformInvite } from "./transformers/invite.ts";
|
||||
import * as helpers from "./helpers/mod.ts";
|
||||
import { Emoji, transformEmoji } from "./transformers/emoji.ts";
|
||||
import { transformActivity } from "./transformers/activity.ts";
|
||||
import { PresenceUpdate, transformPresence } from "./transformers/presence.ts";
|
||||
import { urlToBase64 } from "./util/urlToBase64.ts";
|
||||
import { transformAttachment } from "./transformers/attachment.ts";
|
||||
import { transformEmbed } from "./transformers/embed.ts";
|
||||
import { transformComponent } from "./transformers/component.ts";
|
||||
import { transformWebhook } from "./transformers/webhook.ts";
|
||||
import { transformAuditLogEntry } from "./transformers/auditLogEntry.ts";
|
||||
import { transformApplicationCommandPermission } from "./transformers/applicationCommandPermission.ts";
|
||||
import { calculateBits, calculatePermissions } from "./util/permissions.ts";
|
||||
import { transformScheduledEvent } from "./transformers/scheduledEvent.ts";
|
||||
import { ThreadMember, transformThreadMember } from "./transformers/threadMember.ts";
|
||||
import { transformApplicationCommandOption } from "./transformers/applicationCommandOption.ts";
|
||||
import { transformApplicationCommand } from "./transformers/applicationCommand.ts";
|
||||
import { transformWelcomeScreen } from "./transformers/welcomeScreen.ts";
|
||||
import { transformVoiceRegion } from "./transformers/voiceRegion.ts";
|
||||
import { transformWidget } from "./transformers/widget.ts";
|
||||
import { transformWidgetSettings } from "./transformers/widgetSettings.ts";
|
||||
import { transformStageInstance } from "./transformers/stageInstance.ts";
|
||||
import { StickerPack, transformSticker, transformStickerPack } from "./transformers/sticker.ts";
|
||||
import { GetGatewayBot, transformGatewayBot } from "./transformers/gatewayBot.ts";
|
||||
import {
|
||||
DiscordAllowedMentions,
|
||||
DiscordApplicationCommandOptionChoice,
|
||||
DiscordAutoModerationActionExecution,
|
||||
DiscordAutoModerationRule,
|
||||
DiscordEmoji,
|
||||
DiscordGatewayPayload,
|
||||
DiscordInteractionDataOption,
|
||||
DiscordReady,
|
||||
DiscordStickerPack,
|
||||
DiscordTemplate,
|
||||
} from "./types/discord.ts";
|
||||
import { Errors, GatewayDispatchEventNames, GatewayIntents } from "./types/shared.ts";
|
||||
|
||||
import {
|
||||
DiscordActivity,
|
||||
DiscordAllowedMentions,
|
||||
DiscordApplication,
|
||||
DiscordApplicationCommand,
|
||||
DiscordApplicationCommandOption,
|
||||
DiscordApplicationCommandOptionChoice,
|
||||
DiscordAttachment,
|
||||
DiscordAuditLogEntry,
|
||||
DiscordAutoModerationActionExecution,
|
||||
DiscordAutoModerationRule,
|
||||
DiscordChannel,
|
||||
DiscordComponent,
|
||||
DiscordEmbed,
|
||||
DiscordEmoji,
|
||||
DISCORDENO_VERSION,
|
||||
DiscordGatewayPayload,
|
||||
DiscordGetGatewayBot,
|
||||
DiscordGuild,
|
||||
DiscordGuildApplicationCommandPermissions,
|
||||
@@ -99,60 +34,101 @@ import {
|
||||
DiscordGuildWidgetSettings,
|
||||
DiscordIntegrationCreateUpdate,
|
||||
DiscordInteraction,
|
||||
DiscordInteractionDataOption,
|
||||
DiscordInviteCreate,
|
||||
DiscordMember,
|
||||
DiscordMessage,
|
||||
DiscordPresenceUpdate,
|
||||
DiscordReady,
|
||||
DiscordRole,
|
||||
DiscordScheduledEvent,
|
||||
DiscordStageInstance,
|
||||
DiscordSticker,
|
||||
DiscordStickerPack,
|
||||
DiscordTeam,
|
||||
DiscordTemplate,
|
||||
DiscordThreadMember,
|
||||
DiscordUser,
|
||||
DiscordVoiceRegion,
|
||||
DiscordVoiceState,
|
||||
DiscordWebhook,
|
||||
DiscordWelcomeScreen,
|
||||
} from "./types/discord.ts";
|
||||
|
||||
import { Application } from "./transformers/application.ts";
|
||||
import { Team } from "./transformers/team.ts";
|
||||
import { Activity } from "./transformers/activity.ts";
|
||||
import { Attachment } from "./transformers/attachment.ts";
|
||||
import { Embed } from "./transformers/embed.ts";
|
||||
import { Webhook } from "./transformers/webhook.ts";
|
||||
import { Component } from "./transformers/component.ts";
|
||||
import { ApplicationCommand } from "./transformers/applicationCommand.ts";
|
||||
import { AuditLogEntry } from "./transformers/auditLogEntry.ts";
|
||||
import { ApplicationCommandOption } from "./transformers/applicationCommandOption.ts";
|
||||
import { ApplicationCommandPermission } from "./transformers/applicationCommandPermission.ts";
|
||||
import { WelcomeScreen } from "./transformers/welcomeScreen.ts";
|
||||
import { VoiceRegions } from "./transformers/voiceRegion.ts";
|
||||
import { GuildWidget } from "./transformers/widget.ts";
|
||||
import { GuildWidgetSettings } from "./transformers/widgetSettings.ts";
|
||||
import { StageInstance } from "./transformers/stageInstance.ts";
|
||||
import { Sticker } from "./transformers/sticker.ts";
|
||||
Errors,
|
||||
GatewayDispatchEventNames,
|
||||
GatewayIntents,
|
||||
getBotIdFromToken,
|
||||
removeTokenPrefix,
|
||||
SLASH_COMMANDS_NAME_REGEX,
|
||||
USER_AGENT,
|
||||
} from "./deps.ts";
|
||||
import { Activity, transformActivity } from "./transformers/activity.ts";
|
||||
import { Application, transformApplication } from "./transformers/application.ts";
|
||||
import { ApplicationCommand, transformApplicationCommand } from "./transformers/applicationCommand.ts";
|
||||
import {
|
||||
ApplicationCommandOption,
|
||||
transformApplicationCommandOption,
|
||||
} from "./transformers/applicationCommandOption.ts";
|
||||
import {
|
||||
ApplicationCommandOptionChoice,
|
||||
transformApplicationCommandOptionChoice,
|
||||
} from "./transformers/applicationCommandOptionChoice.ts";
|
||||
import { transformEmbedToDiscordEmbed } from "./transformers/reverse/embed.ts";
|
||||
import { transformComponentToDiscordComponent } from "./transformers/reverse/component.ts";
|
||||
import { transformActivityToDiscordActivity } from "./transformers/reverse/activity.ts";
|
||||
import { transformTeamToDiscordTeam } from "./transformers/reverse/team.ts";
|
||||
import { transformMemberToDiscordMember, transformUserToDiscordUser } from "./transformers/reverse/member.ts";
|
||||
import { transformApplicationToDiscordApplication } from "./transformers/reverse/application.ts";
|
||||
import { getBotIdFromToken, removeTokenPrefix } from "./util/token.ts";
|
||||
import { CreateShardManager } from "./gateway/manager/shardManager.ts";
|
||||
import { AutoModerationRule, transformAutoModerationRule } from "./transformers/automodRule.ts";
|
||||
import {
|
||||
ApplicationCommandPermission,
|
||||
transformApplicationCommandPermission,
|
||||
} from "./transformers/applicationCommandPermission.ts";
|
||||
import { Attachment, transformAttachment } from "./transformers/attachment.ts";
|
||||
import { AuditLogEntry, transformAuditLogEntry } from "./transformers/auditLogEntry.ts";
|
||||
import {
|
||||
AutoModerationActionExecution,
|
||||
transformAutoModerationActionExecution,
|
||||
} from "./transformers/automodActionExecution.ts";
|
||||
import { routes } from "./util/routes.ts";
|
||||
import { AutoModerationRule, transformAutoModerationRule } from "./transformers/automodRule.ts";
|
||||
import { Channel, transformChannel } from "./transformers/channel.ts";
|
||||
import { Component, transformComponent } from "./transformers/component.ts";
|
||||
import { Embed, transformEmbed } from "./transformers/embed.ts";
|
||||
import { Emoji, transformEmoji } from "./transformers/emoji.ts";
|
||||
import { GetGatewayBot, transformGatewayBot } from "./transformers/gatewayBot.ts";
|
||||
import { Guild, transformGuild } from "./transformers/guild.ts";
|
||||
import { Integration, transformIntegration } from "./transformers/integration.ts";
|
||||
import {
|
||||
Interaction,
|
||||
InteractionDataOption,
|
||||
transformInteraction,
|
||||
transformInteractionDataOption,
|
||||
} from "./transformers/interaction.ts";
|
||||
import { Invite, transformInvite } from "./transformers/invite.ts";
|
||||
import { Member, transformMember, transformUser, User } from "./transformers/member.ts";
|
||||
import { Message, transformMessage } from "./transformers/message.ts";
|
||||
import { PresenceUpdate, transformPresence } from "./transformers/presence.ts";
|
||||
import { transformActivityToDiscordActivity } from "./transformers/reverse/activity.ts";
|
||||
import { transformAllowedMentionsToDiscordAllowedMentions } from "./transformers/reverse/allowedMentions.ts";
|
||||
import { AllowedMentions } from "./mod.ts";
|
||||
import { transformApplicationToDiscordApplication } from "./transformers/reverse/application.ts";
|
||||
import { transformComponentToDiscordComponent } from "./transformers/reverse/component.ts";
|
||||
import { transformEmbedToDiscordEmbed } from "./transformers/reverse/embed.ts";
|
||||
import { transformMemberToDiscordMember, transformUserToDiscordUser } from "./transformers/reverse/member.ts";
|
||||
import { transformTeamToDiscordTeam } from "./transformers/reverse/team.ts";
|
||||
import { Role, transformRole } from "./transformers/role.ts";
|
||||
import { ScheduledEvent, transformScheduledEvent } from "./transformers/scheduledEvent.ts";
|
||||
import { StageInstance, transformStageInstance } from "./transformers/stageInstance.ts";
|
||||
import { Sticker, StickerPack, transformSticker, transformStickerPack } from "./transformers/sticker.ts";
|
||||
import { Team, transformTeam } from "./transformers/team.ts";
|
||||
import { Template, transformTemplate } from "./transformers/template.ts";
|
||||
import { ThreadMember, transformThreadMember } from "./transformers/threadMember.ts";
|
||||
import { transformVoiceRegion, VoiceRegions } from "./transformers/voiceRegion.ts";
|
||||
import { transformVoiceState, VoiceState } from "./transformers/voiceState.ts";
|
||||
import { transformWebhook, Webhook } from "./transformers/webhook.ts";
|
||||
import { transformWelcomeScreen, WelcomeScreen } from "./transformers/welcomeScreen.ts";
|
||||
import { GuildWidget, transformWidget } from "./transformers/widget.ts";
|
||||
import { GuildWidgetSettings, transformWidgetSettings } from "./transformers/widgetSettings.ts";
|
||||
import { AllowedMentions } from "./typings.ts";
|
||||
import { bigintToSnowflake, snowflakeToBigint } from "./util/bigint.ts";
|
||||
import { BotCollection } from "./util/collection.ts";
|
||||
import { iconBigintToHash, iconHashToBigInt } from "./util/hash.ts";
|
||||
import { calculateBits, calculatePermissions } from "./util/permissions.ts";
|
||||
import { routes } from "./util/routes.ts";
|
||||
import { urlToBase64 } from "./util/urlToBase64.ts";
|
||||
import { formatImageURL } from "./util/utils.ts";
|
||||
import { validateLength } from "./util/validateLength.ts";
|
||||
|
||||
export function createBot(options: CreateBotOptions): Bot {
|
||||
const bot = {
|
||||
@@ -306,7 +282,6 @@ export function createUtils(options: Partial<HelperUtils>) {
|
||||
export interface HelperUtils {
|
||||
snowflakeToBigint: typeof snowflakeToBigint;
|
||||
bigintToSnowflake: typeof bigintToSnowflake;
|
||||
calculateShardId: typeof calculateShardId;
|
||||
delay: typeof delay;
|
||||
iconHashToBigInt: typeof iconHashToBigInt;
|
||||
iconBigintToHash: typeof iconBigintToHash;
|
||||
@@ -706,7 +681,7 @@ export interface EventHandlers {
|
||||
bot: Bot,
|
||||
payload: {
|
||||
guildId: bigint;
|
||||
emojis: Collection<bigint, DiscordEmoji>;
|
||||
emojis: BotCollection<bigint, DiscordEmoji>;
|
||||
},
|
||||
) => unknown;
|
||||
guildBanAdd: (bot: Bot, user: User, guildId: bigint) => unknown;
|
||||
1
plugins/bot/deps.ts
Normal file
1
plugins/bot/deps.ts
Normal file
@@ -0,0 +1 @@
|
||||
export * from "../../mod.ts";
|
||||
@@ -1,5 +1,5 @@
|
||||
import type { Bot } from "../../bot.ts";
|
||||
import { DiscordChannel, DiscordGatewayPayload } from "../../types/discord.ts";
|
||||
import { Bot } from "../../bot.ts";
|
||||
import { DiscordChannel, DiscordGatewayPayload } from "../../deps.ts";
|
||||
|
||||
export async function handleChannelCreate(bot: Bot, payload: DiscordGatewayPayload) {
|
||||
const channel = bot.transformers.channel(bot, { channel: payload.d as DiscordChannel });
|
||||
@@ -1,5 +1,5 @@
|
||||
import type { Bot } from "../../bot.ts";
|
||||
import { DiscordChannel, DiscordGatewayPayload } from "../../types/discord.ts";
|
||||
import { Bot } from "../../bot.ts";
|
||||
import { DiscordChannel, DiscordGatewayPayload } from "../../deps.ts";
|
||||
|
||||
export async function handleChannelDelete(bot: Bot, data: DiscordGatewayPayload) {
|
||||
const payload = data.d as DiscordChannel;
|
||||
@@ -1,5 +1,5 @@
|
||||
import type { Bot } from "../../bot.ts";
|
||||
import { DiscordChannelPinsUpdate, DiscordGatewayPayload } from "../../types/discord.ts";
|
||||
import { Bot } from "../../bot.ts";
|
||||
import { DiscordChannelPinsUpdate, DiscordGatewayPayload } from "../../deps.ts";
|
||||
|
||||
export async function handleChannelPinsUpdate(bot: Bot, data: DiscordGatewayPayload) {
|
||||
const payload = data.d as DiscordChannelPinsUpdate;
|
||||
@@ -1,5 +1,5 @@
|
||||
import type { Bot } from "../../bot.ts";
|
||||
import { DiscordChannel, DiscordGatewayPayload } from "../../types/discord.ts";
|
||||
import { Bot } from "../../bot.ts";
|
||||
import { DiscordChannel, DiscordGatewayPayload } from "../../deps.ts";
|
||||
|
||||
export async function handleChannelUpdate(bot: Bot, data: DiscordGatewayPayload) {
|
||||
const payload = data.d as DiscordChannel;
|
||||
@@ -1,5 +1,5 @@
|
||||
import type { Bot } from "../../bot.ts";
|
||||
import { DiscordGatewayPayload, DiscordStageInstance } from "../../types/discord.ts";
|
||||
import { Bot } from "../../bot.ts";
|
||||
import { DiscordGatewayPayload, DiscordStageInstance } from "../../deps.ts";
|
||||
|
||||
export function handleStageInstanceCreate(bot: Bot, data: DiscordGatewayPayload) {
|
||||
const payload = data.d as DiscordStageInstance;
|
||||
@@ -1,5 +1,5 @@
|
||||
import type { Bot } from "../../bot.ts";
|
||||
import { DiscordGatewayPayload, DiscordStageInstance } from "../../types/discord.ts";
|
||||
import { Bot } from "../../bot.ts";
|
||||
import { DiscordGatewayPayload, DiscordStageInstance } from "../../deps.ts";
|
||||
|
||||
export function handleStageInstanceDelete(bot: Bot, data: DiscordGatewayPayload) {
|
||||
const payload = data.d as DiscordStageInstance;
|
||||
@@ -1,5 +1,5 @@
|
||||
import type { Bot } from "../../bot.ts";
|
||||
import { DiscordGatewayPayload, DiscordStageInstance } from "../../types/discord.ts";
|
||||
import { Bot } from "../../bot.ts";
|
||||
import { DiscordGatewayPayload, DiscordStageInstance } from "../../deps.ts";
|
||||
|
||||
export function handleStageInstanceUpdate(bot: Bot, data: DiscordGatewayPayload) {
|
||||
const payload = data.d as DiscordStageInstance;
|
||||
@@ -1,5 +1,5 @@
|
||||
import { Bot } from "../../bot.ts";
|
||||
import { DiscordChannel, DiscordGatewayPayload } from "../../types/discord.ts";
|
||||
import { DiscordChannel, DiscordGatewayPayload } from "../../deps.ts";
|
||||
|
||||
export async function handleThreadCreate(bot: Bot, data: DiscordGatewayPayload) {
|
||||
const payload = data.d as DiscordChannel;
|
||||
@@ -1,5 +1,5 @@
|
||||
import { Bot } from "../../bot.ts";
|
||||
import { DiscordChannel, DiscordGatewayPayload } from "../../types/discord.ts";
|
||||
import { DiscordChannel, DiscordGatewayPayload } from "../../deps.ts";
|
||||
|
||||
export async function handleThreadDelete(bot: Bot, data: DiscordGatewayPayload) {
|
||||
const payload = data.d as DiscordChannel;
|
||||
@@ -1,5 +1,5 @@
|
||||
import { Bot } from "../../bot.ts";
|
||||
import { DiscordGatewayPayload, DiscordThreadListSync } from "../../types/discord.ts";
|
||||
import { DiscordGatewayPayload, DiscordThreadListSync } from "../../deps.ts";
|
||||
|
||||
export async function handleThreadListSync(bot: Bot, data: DiscordGatewayPayload) {
|
||||
const payload = data.d as DiscordThreadListSync;
|
||||
@@ -1,5 +1,5 @@
|
||||
import { Bot } from "../../bot.ts";
|
||||
import { DiscordGatewayPayload, DiscordThreadMembersUpdate } from "../../types/discord.ts";
|
||||
import { DiscordGatewayPayload, DiscordThreadMembersUpdate } from "../../deps.ts";
|
||||
|
||||
export async function handleThreadMembersUpdate(bot: Bot, data: DiscordGatewayPayload) {
|
||||
const payload = data.d as DiscordThreadMembersUpdate;
|
||||
@@ -1,5 +1,5 @@
|
||||
import { Bot } from "../../bot.ts";
|
||||
import { DiscordGatewayPayload, DiscordThreadMemberUpdate } from "../../types/discord.ts";
|
||||
import { DiscordGatewayPayload, DiscordThreadMemberUpdate } from "../../deps.ts";
|
||||
|
||||
export async function handleThreadMemberUpdate(bot: Bot, data: DiscordGatewayPayload) {
|
||||
const payload = data.d as DiscordThreadMemberUpdate;
|
||||
@@ -1,5 +1,5 @@
|
||||
import { Bot } from "../../bot.ts";
|
||||
import { DiscordChannel, DiscordGatewayPayload } from "../../types/discord.ts";
|
||||
import { DiscordChannel, DiscordGatewayPayload } from "../../deps.ts";
|
||||
|
||||
export async function handleThreadUpdate(bot: Bot, data: DiscordGatewayPayload) {
|
||||
const payload = data.d as DiscordChannel;
|
||||
@@ -1,6 +1,6 @@
|
||||
import type { Bot } from "../../bot.ts";
|
||||
import { DiscordGatewayPayload, DiscordGuildEmojisUpdate } from "../../types/discord.ts";
|
||||
import { Collection } from "../../util/collection.ts";
|
||||
import { Bot } from "../../bot.ts";
|
||||
import { DiscordGatewayPayload, DiscordGuildEmojisUpdate } from "../../deps.ts";
|
||||
import { BotCollection as Collection } from "../../util/collection.ts";
|
||||
|
||||
export async function handleGuildEmojisUpdate(bot: Bot, data: DiscordGatewayPayload) {
|
||||
const payload = data.d as DiscordGuildEmojisUpdate;
|
||||
@@ -1,5 +1,5 @@
|
||||
import type { Bot } from "../../bot.ts";
|
||||
import { DiscordGatewayPayload, DiscordGuildBanAddRemove } from "../../types/discord.ts";
|
||||
import { Bot } from "../../bot.ts";
|
||||
import { DiscordGatewayPayload, DiscordGuildBanAddRemove } from "../../deps.ts";
|
||||
|
||||
export async function handleGuildBanAdd(bot: Bot, data: DiscordGatewayPayload) {
|
||||
const payload = data.d as DiscordGuildBanAddRemove;
|
||||
@@ -1,5 +1,5 @@
|
||||
import type { Bot } from "../../bot.ts";
|
||||
import { DiscordGatewayPayload, DiscordGuildBanAddRemove } from "../../types/discord.ts";
|
||||
import { Bot } from "../../bot.ts";
|
||||
import { DiscordGatewayPayload, DiscordGuildBanAddRemove } from "../../deps.ts";
|
||||
|
||||
export async function handleGuildBanRemove(bot: Bot, data: DiscordGatewayPayload) {
|
||||
const payload = data.d as DiscordGuildBanAddRemove;
|
||||
@@ -1,6 +1,6 @@
|
||||
import type { Bot } from "../../bot.ts";
|
||||
import { Bot } from "../../bot.ts";
|
||||
import type { Guild } from "../../transformers/guild.ts";
|
||||
import { DiscordGatewayPayload, DiscordGuild } from "../../types/discord.ts";
|
||||
import { DiscordGatewayPayload, DiscordGuild } from "../../deps.ts";
|
||||
|
||||
export function handleGuildCreate(bot: Bot, data: DiscordGatewayPayload, shardId: number) {
|
||||
const payload = data.d as DiscordGuild;
|
||||
@@ -1,5 +1,5 @@
|
||||
import type { Bot } from "../../bot.ts";
|
||||
import { DiscordGatewayPayload, DiscordUnavailableGuild } from "../../types/discord.ts";
|
||||
import { Bot } from "../../bot.ts";
|
||||
import { DiscordGatewayPayload, DiscordUnavailableGuild } from "../../deps.ts";
|
||||
|
||||
export async function handleGuildDelete(bot: Bot, data: DiscordGatewayPayload, shardId: number) {
|
||||
const payload = data.d as DiscordUnavailableGuild;
|
||||
@@ -1,5 +1,5 @@
|
||||
import type { Bot } from "../../bot.ts";
|
||||
import { DiscordGatewayPayload, DiscordGuildIntegrationsUpdate } from "../../types/discord.ts";
|
||||
import { Bot } from "../../bot.ts";
|
||||
import { DiscordGatewayPayload, DiscordGuildIntegrationsUpdate } from "../../deps.ts";
|
||||
|
||||
export async function handleGuildIntegrationsUpdate(bot: Bot, data: DiscordGatewayPayload) {
|
||||
const payload = data.d as DiscordGuildIntegrationsUpdate;
|
||||
@@ -1,6 +1,6 @@
|
||||
import type { Bot } from "../../bot.ts";
|
||||
import { Bot } from "../../bot.ts";
|
||||
import type { Guild } from "../../transformers/guild.ts";
|
||||
import { DiscordGatewayPayload, DiscordGuild } from "../../types/discord.ts";
|
||||
import { DiscordGatewayPayload, DiscordGuild } from "../../deps.ts";
|
||||
|
||||
export function handleGuildLoaded(bot: Bot, data: DiscordGatewayPayload, shardId: number) {
|
||||
const payload = data.d as DiscordGuild;
|
||||
@@ -1,6 +1,6 @@
|
||||
import type { Bot } from "../../bot.ts";
|
||||
import { Bot } from "../../bot.ts";
|
||||
import type { Guild } from "../../transformers/guild.ts";
|
||||
import { DiscordGatewayPayload, DiscordGuild } from "../../types/discord.ts";
|
||||
import { DiscordGatewayPayload, DiscordGuild } from "../../deps.ts";
|
||||
|
||||
export function handleGuildUpdate(bot: Bot, data: DiscordGatewayPayload, shardId: number) {
|
||||
const payload = data.d as DiscordGuild;
|
||||
@@ -1,5 +1,5 @@
|
||||
import type { Bot } from "../../../bot.ts";
|
||||
import { DiscordAutoModerationActionExecution, DiscordGatewayPayload } from "../../../types/discord.ts";
|
||||
import { Bot } from "../../../bot.ts";
|
||||
import { DiscordAutoModerationActionExecution, DiscordGatewayPayload } from "../../../deps.ts";
|
||||
|
||||
/** Requires the MANAGE_GUILD permission. */
|
||||
export function handleAutoModerationActionExecution(bot: Bot, data: DiscordGatewayPayload, shardId: number) {
|
||||
@@ -1,5 +1,5 @@
|
||||
import type { Bot } from "../../../bot.ts";
|
||||
import { DiscordAutoModerationRule, DiscordGatewayPayload } from "../../../types/discord.ts";
|
||||
import { Bot } from "../../../bot.ts";
|
||||
import { DiscordAutoModerationRule, DiscordGatewayPayload } from "../../../deps.ts";
|
||||
|
||||
/** Requires the MANAGE_GUILD permission. */
|
||||
export function handleAutoModerationRuleCreate(bot: Bot, data: DiscordGatewayPayload, shardId: number) {
|
||||
@@ -1,5 +1,5 @@
|
||||
import type { Bot } from "../../../bot.ts";
|
||||
import { DiscordAutoModerationRule, DiscordGatewayPayload } from "../../../types/discord.ts";
|
||||
import { Bot } from "../../../bot.ts";
|
||||
import { DiscordAutoModerationRule, DiscordGatewayPayload } from "../../../deps.ts";
|
||||
|
||||
/** Requires the MANAGE_GUILD permission. */
|
||||
export function handleAutoModerationRuleDelete(bot: Bot, data: DiscordGatewayPayload, shardId: number) {
|
||||
@@ -1,5 +1,5 @@
|
||||
import type { Bot } from "../../../bot.ts";
|
||||
import { DiscordAutoModerationRule, DiscordGatewayPayload } from "../../../types/discord.ts";
|
||||
import { Bot } from "../../../bot.ts";
|
||||
import { DiscordAutoModerationRule, DiscordGatewayPayload } from "../../../deps.ts";
|
||||
|
||||
/** Requires the MANAGE_GUILD permission. */
|
||||
export function handleAutoModerationRuleUpdate(bot: Bot, data: DiscordGatewayPayload, shardId: number) {
|
||||
@@ -1,5 +1,5 @@
|
||||
import type { Bot } from "../../../bot.ts";
|
||||
import { DiscordGatewayPayload, DiscordScheduledEvent } from "../../../types/discord.ts";
|
||||
import { Bot } from "../../../bot.ts";
|
||||
import { DiscordGatewayPayload, DiscordScheduledEvent } from "../../../deps.ts";
|
||||
|
||||
export function handleGuildScheduledEventCreate(bot: Bot, data: DiscordGatewayPayload, shardId: number) {
|
||||
const payload = data.d as DiscordScheduledEvent;
|
||||
@@ -1,5 +1,5 @@
|
||||
import type { Bot } from "../../../bot.ts";
|
||||
import { DiscordGatewayPayload, DiscordScheduledEvent } from "../../../types/discord.ts";
|
||||
import { Bot } from "../../../bot.ts";
|
||||
import { DiscordGatewayPayload, DiscordScheduledEvent } from "../../../deps.ts";
|
||||
|
||||
export function handleGuildScheduledEventDelete(bot: Bot, data: DiscordGatewayPayload) {
|
||||
const payload = data.d as DiscordScheduledEvent;
|
||||
@@ -1,5 +1,5 @@
|
||||
import type { Bot } from "../../../bot.ts";
|
||||
import { DiscordGatewayPayload, DiscordScheduledEvent } from "../../../types/discord.ts";
|
||||
import { Bot } from "../../../bot.ts";
|
||||
import { DiscordGatewayPayload, DiscordScheduledEvent } from "../../../deps.ts";
|
||||
|
||||
export function handleGuildScheduledEventUpdate(bot: Bot, data: DiscordGatewayPayload) {
|
||||
const payload = data.d as DiscordScheduledEvent;
|
||||
@@ -1,5 +1,5 @@
|
||||
import type { Bot } from "../../../bot.ts";
|
||||
import { DiscordGatewayPayload, DiscordScheduledEventUserAdd } from "../../../types/discord.ts";
|
||||
import { Bot } from "../../../bot.ts";
|
||||
import { DiscordGatewayPayload, DiscordScheduledEventUserAdd } from "../../../deps.ts";
|
||||
|
||||
export function handleGuildScheduledEventUserAdd(bot: Bot, data: DiscordGatewayPayload) {
|
||||
const payload = data.d as DiscordScheduledEventUserAdd;
|
||||
@@ -1,5 +1,5 @@
|
||||
import type { Bot } from "../../../bot.ts";
|
||||
import { DiscordGatewayPayload, DiscordScheduledEventUserRemove } from "../../../types/discord.ts";
|
||||
import { Bot } from "../../../bot.ts";
|
||||
import { DiscordGatewayPayload, DiscordScheduledEventUserRemove } from "../../../deps.ts";
|
||||
|
||||
export function handleGuildScheduledEventUserRemove(bot: Bot, data: DiscordGatewayPayload) {
|
||||
const payload = data.d as DiscordScheduledEventUserRemove;
|
||||
@@ -1,5 +1,5 @@
|
||||
import { Bot } from "../../bot.ts";
|
||||
import { DiscordGatewayPayload, DiscordIntegrationCreateUpdate } from "../../types/discord.ts";
|
||||
import { DiscordGatewayPayload, DiscordIntegrationCreateUpdate } from "../../deps.ts";
|
||||
|
||||
export function handleIntegrationCreate(bot: Bot, data: DiscordGatewayPayload) {
|
||||
bot.events.integrationCreate(
|
||||
@@ -1,5 +1,5 @@
|
||||
import { Bot } from "../../bot.ts";
|
||||
import { DiscordGatewayPayload, DiscordIntegrationDelete } from "../../types/discord.ts";
|
||||
import { DiscordGatewayPayload, DiscordIntegrationDelete } from "../../deps.ts";
|
||||
|
||||
export function handleIntegrationDelete(bot: Bot, data: DiscordGatewayPayload) {
|
||||
const payload = data.d as DiscordIntegrationDelete;
|
||||
@@ -1,5 +1,5 @@
|
||||
import { Bot } from "../../bot.ts";
|
||||
import { DiscordGatewayPayload, DiscordIntegrationCreateUpdate } from "../../types/discord.ts";
|
||||
import { DiscordGatewayPayload, DiscordIntegrationCreateUpdate } from "../../deps.ts";
|
||||
|
||||
export function handleIntegrationUpdate(bot: Bot, data: DiscordGatewayPayload) {
|
||||
bot.events.integrationUpdate(
|
||||
@@ -1,5 +1,5 @@
|
||||
import { Bot } from "../../bot.ts";
|
||||
import { DiscordGatewayPayload, DiscordInteraction } from "../../types/discord.ts";
|
||||
import { DiscordGatewayPayload, DiscordInteraction } from "../../deps.ts";
|
||||
|
||||
export async function handleInteractionCreate(bot: Bot, data: DiscordGatewayPayload) {
|
||||
bot.cache.unrepliedInteractions.add(bot.transformers.snowflake((data.d as DiscordInteraction).id));
|
||||
@@ -1,5 +1,5 @@
|
||||
import { Bot } from "../../bot.ts";
|
||||
import { DiscordGatewayPayload, DiscordInviteCreate } from "../../types/discord.ts";
|
||||
import { DiscordGatewayPayload, DiscordInviteCreate } from "../../deps.ts";
|
||||
|
||||
export function handleInviteCreate(bot: Bot, data: DiscordGatewayPayload) {
|
||||
bot.events.inviteCreate(bot, bot.transformers.invite(bot, data.d as DiscordInviteCreate));
|
||||
@@ -1,5 +1,5 @@
|
||||
import { Bot } from "../../bot.ts";
|
||||
import { DiscordGatewayPayload, DiscordInviteDelete } from "../../types/discord.ts";
|
||||
import { DiscordGatewayPayload, DiscordInviteDelete } from "../../deps.ts";
|
||||
|
||||
export function handleInviteDelete(bot: Bot, data: DiscordGatewayPayload) {
|
||||
const payload = data.d as DiscordInviteDelete;
|
||||
@@ -1,6 +1,6 @@
|
||||
import { Bot } from "../../bot.ts";
|
||||
import { statusTypes } from "../../transformers/presence.ts";
|
||||
import { DiscordGatewayPayload, DiscordGuildMembersChunk } from "../../types/discord.ts";
|
||||
import { DiscordGatewayPayload, DiscordGuildMembersChunk } from "../../deps.ts";
|
||||
|
||||
export async function handleGuildMembersChunk(bot: Bot, data: DiscordGatewayPayload) {
|
||||
const payload = data.d as DiscordGuildMembersChunk;
|
||||
@@ -1,5 +1,5 @@
|
||||
import { Bot } from "../../bot.ts";
|
||||
import { DiscordGatewayPayload, DiscordGuildMemberAdd } from "../../types/discord.ts";
|
||||
import { DiscordGatewayPayload, DiscordGuildMemberAdd } from "../../deps.ts";
|
||||
|
||||
export async function handleGuildMemberAdd(bot: Bot, data: DiscordGatewayPayload) {
|
||||
const payload = data.d as DiscordGuildMemberAdd;
|
||||
@@ -1,5 +1,5 @@
|
||||
import { Bot } from "../../bot.ts";
|
||||
import { DiscordGatewayPayload, DiscordGuildMemberRemove } from "../../types/discord.ts";
|
||||
import { DiscordGatewayPayload, DiscordGuildMemberRemove } from "../../deps.ts";
|
||||
|
||||
export async function handleGuildMemberRemove(bot: Bot, data: DiscordGatewayPayload) {
|
||||
const payload = data.d as DiscordGuildMemberRemove;
|
||||
@@ -1,5 +1,5 @@
|
||||
import { Bot } from "../../bot.ts";
|
||||
import { DiscordGatewayPayload, DiscordGuildMemberUpdate } from "../../types/discord.ts";
|
||||
import { DiscordGatewayPayload, DiscordGuildMemberUpdate } from "../../deps.ts";
|
||||
|
||||
export async function handleGuildMemberUpdate(bot: Bot, data: DiscordGatewayPayload) {
|
||||
const payload = data.d as DiscordGuildMemberUpdate;
|
||||
@@ -1,5 +1,5 @@
|
||||
import { Bot } from "../../bot.ts";
|
||||
import { DiscordGatewayPayload, DiscordMessage } from "../../types/discord.ts";
|
||||
import { DiscordGatewayPayload, DiscordMessage } from "../../deps.ts";
|
||||
|
||||
export async function handleMessageCreate(bot: Bot, data: DiscordGatewayPayload) {
|
||||
const payload = data.d as DiscordMessage;
|
||||
@@ -1,5 +1,5 @@
|
||||
import { Bot } from "../../bot.ts";
|
||||
import { DiscordGatewayPayload, DiscordMessageDelete } from "../../types/discord.ts";
|
||||
import { DiscordGatewayPayload, DiscordMessageDelete } from "../../deps.ts";
|
||||
|
||||
export async function handleMessageDelete(bot: Bot, data: DiscordGatewayPayload) {
|
||||
const payload = data.d as DiscordMessageDelete;
|
||||
@@ -1,5 +1,5 @@
|
||||
import { Bot } from "../../bot.ts";
|
||||
import { DiscordGatewayPayload, DiscordMessageDeleteBulk } from "../../types/discord.ts";
|
||||
import { DiscordGatewayPayload, DiscordMessageDeleteBulk } from "../../deps.ts";
|
||||
|
||||
export async function handleMessageDeleteBulk(bot: Bot, data: DiscordGatewayPayload) {
|
||||
const payload = data.d as DiscordMessageDeleteBulk;
|
||||
@@ -1,5 +1,5 @@
|
||||
import { Bot } from "../../bot.ts";
|
||||
import { DiscordGatewayPayload, DiscordMessageReactionAdd } from "../../types/discord.ts";
|
||||
import { DiscordGatewayPayload, DiscordMessageReactionAdd } from "../../deps.ts";
|
||||
|
||||
export async function handleMessageReactionAdd(bot: Bot, data: DiscordGatewayPayload) {
|
||||
const payload = data.d as DiscordMessageReactionAdd;
|
||||
@@ -1,5 +1,5 @@
|
||||
import { Bot } from "../../bot.ts";
|
||||
import { DiscordGatewayPayload, DiscordMessageReactionRemove } from "../../types/discord.ts";
|
||||
import { DiscordGatewayPayload, DiscordMessageReactionRemove } from "../../deps.ts";
|
||||
|
||||
export async function handleMessageReactionRemove(bot: Bot, data: DiscordGatewayPayload) {
|
||||
const payload = data.d as DiscordMessageReactionRemove;
|
||||
@@ -1,5 +1,5 @@
|
||||
import { Bot } from "../../bot.ts";
|
||||
import { DiscordGatewayPayload, DiscordMessageReactionRemoveAll } from "../../types/discord.ts";
|
||||
import { DiscordGatewayPayload, DiscordMessageReactionRemoveAll } from "../../deps.ts";
|
||||
|
||||
export async function handleMessageReactionRemoveAll(bot: Bot, data: DiscordGatewayPayload) {
|
||||
const payload = data.d as DiscordMessageReactionRemoveAll;
|
||||
@@ -1,5 +1,5 @@
|
||||
import { Bot } from "../../bot.ts";
|
||||
import { DiscordGatewayPayload, DiscordMessageReactionRemoveEmoji } from "../../types/discord.ts";
|
||||
import { DiscordGatewayPayload, DiscordMessageReactionRemoveEmoji } from "../../deps.ts";
|
||||
|
||||
export async function handleMessageReactionRemoveEmoji(bot: Bot, data: DiscordGatewayPayload) {
|
||||
const payload = data.d as DiscordMessageReactionRemoveEmoji;
|
||||
@@ -1,5 +1,5 @@
|
||||
import { Bot } from "../../bot.ts";
|
||||
import { DiscordGatewayPayload, DiscordMessage } from "../../types/discord.ts";
|
||||
import { DiscordGatewayPayload, DiscordMessage } from "../../deps.ts";
|
||||
|
||||
export async function handleMessageUpdate(bot: Bot, data: DiscordGatewayPayload) {
|
||||
const payload = data.d as DiscordMessage;
|
||||
@@ -1,5 +1,5 @@
|
||||
import { Bot } from "../../bot.ts";
|
||||
import { DiscordGatewayPayload, DiscordPresenceUpdate } from "../../types/discord.ts";
|
||||
import { DiscordGatewayPayload, DiscordPresenceUpdate } from "../../deps.ts";
|
||||
|
||||
export async function handlePresenceUpdate(bot: Bot, data: DiscordGatewayPayload) {
|
||||
bot.events.presenceUpdate(bot, bot.transformers.presence(bot, data.d as DiscordPresenceUpdate));
|
||||
@@ -1,5 +1,5 @@
|
||||
import { Bot } from "../../bot.ts";
|
||||
import { DiscordGatewayPayload, DiscordReady } from "../../types/discord.ts";
|
||||
import { DiscordGatewayPayload, DiscordReady } from "../../deps.ts";
|
||||
|
||||
export function handleReady(bot: Bot, data: DiscordGatewayPayload, shardId: number) {
|
||||
const payload = data.d as DiscordReady;
|
||||
@@ -1,5 +1,5 @@
|
||||
import { Bot } from "../../bot.ts";
|
||||
import { DiscordGatewayPayload, DiscordTypingStart } from "../../types/discord.ts";
|
||||
import { DiscordGatewayPayload, DiscordTypingStart } from "../../deps.ts";
|
||||
|
||||
export function handleTypingStart(bot: Bot, data: DiscordGatewayPayload) {
|
||||
const payload = data.d as DiscordTypingStart;
|
||||
@@ -1,5 +1,5 @@
|
||||
import { Bot } from "../../bot.ts";
|
||||
import { DiscordGatewayPayload, DiscordUser } from "../../types/discord.ts";
|
||||
import { DiscordGatewayPayload, DiscordUser } from "../../deps.ts";
|
||||
|
||||
export async function handleUserUpdate(bot: Bot, data: DiscordGatewayPayload) {
|
||||
const payload = data.d as DiscordUser;
|
||||
@@ -1,5 +1,5 @@
|
||||
import { Bot } from "../../bot.ts";
|
||||
import { DiscordGatewayPayload, DiscordGuildRoleCreate } from "../../types/discord.ts";
|
||||
import { DiscordGatewayPayload, DiscordGuildRoleCreate } from "../../deps.ts";
|
||||
|
||||
export async function handleGuildRoleCreate(bot: Bot, data: DiscordGatewayPayload) {
|
||||
const payload = data.d as DiscordGuildRoleCreate;
|
||||
@@ -1,5 +1,5 @@
|
||||
import { Bot } from "../../bot.ts";
|
||||
import { DiscordGatewayPayload, DiscordGuildRoleDelete } from "../../types/discord.ts";
|
||||
import { DiscordGatewayPayload, DiscordGuildRoleDelete } from "../../deps.ts";
|
||||
|
||||
export async function handleGuildRoleDelete(bot: Bot, data: DiscordGatewayPayload) {
|
||||
const payload = data.d as DiscordGuildRoleDelete;
|
||||
@@ -1,5 +1,5 @@
|
||||
import { Bot } from "../../bot.ts";
|
||||
import { DiscordGatewayPayload, DiscordGuildRoleUpdate } from "../../types/discord.ts";
|
||||
import { DiscordGatewayPayload, DiscordGuildRoleUpdate } from "../../deps.ts";
|
||||
|
||||
export async function handleGuildRoleUpdate(bot: Bot, data: DiscordGatewayPayload) {
|
||||
const payload = data.d as DiscordGuildRoleUpdate;
|
||||
@@ -1,5 +1,5 @@
|
||||
import { Bot } from "../../bot.ts";
|
||||
import { DiscordGatewayPayload, DiscordVoiceServerUpdate } from "../../types/discord.ts";
|
||||
import { DiscordGatewayPayload, DiscordVoiceServerUpdate } from "../../deps.ts";
|
||||
|
||||
export async function handleVoiceServerUpdate(bot: Bot, data: DiscordGatewayPayload) {
|
||||
const payload = data.d as DiscordVoiceServerUpdate;
|
||||
@@ -1,5 +1,5 @@
|
||||
import { Bot } from "../../bot.ts";
|
||||
import { DiscordGatewayPayload, DiscordVoiceState } from "../../types/discord.ts";
|
||||
import { DiscordGatewayPayload, DiscordVoiceState } from "../../deps.ts";
|
||||
|
||||
export async function handleVoiceStateUpdate(bot: Bot, data: DiscordGatewayPayload) {
|
||||
const payload = data.d as DiscordVoiceState;
|
||||
@@ -1,5 +1,5 @@
|
||||
import { Bot } from "../../bot.ts";
|
||||
import { DiscordGatewayPayload, DiscordWebhookUpdate } from "../../types/discord.ts";
|
||||
import { DiscordGatewayPayload, DiscordWebhookUpdate } from "../../deps.ts";
|
||||
|
||||
export function handleWebhooksUpdate(bot: Bot, data: DiscordGatewayPayload) {
|
||||
const payload = data.d as DiscordWebhookUpdate;
|
||||
@@ -1,6 +1,5 @@
|
||||
import type { Bot } from "../../bot.ts";
|
||||
import { ChannelTypes } from "../../types/shared.ts";
|
||||
import { DiscordChannel } from "../../types/discord.ts";
|
||||
import { Bot } from "../../bot.ts";
|
||||
import { ChannelTypes, DiscordChannel } from "../../deps.ts";
|
||||
import { OverwriteReadable } from "./editChannelOverwrite.ts";
|
||||
|
||||
/** Create a channel in your server. Bot needs MANAGE_CHANNEL permissions in the server. */
|
||||
@@ -1,5 +1,5 @@
|
||||
import type { Bot } from "../../bot.ts";
|
||||
import { DiscordStageInstance } from "../../types/discord.ts";
|
||||
import { Bot } from "../../bot.ts";
|
||||
import { DiscordStageInstance } from "../../deps.ts";
|
||||
|
||||
/** Creates a new Stage instance associated to a Stage channel. Requires the user to be a moderator of the Stage channel. */
|
||||
export async function createStageInstance(bot: Bot, options: CreateStageInstance) {
|
||||
@@ -1,5 +1,5 @@
|
||||
import type { Bot } from "../../bot.ts";
|
||||
import { DiscordChannel } from "../../types/discord.ts";
|
||||
import { Bot } from "../../bot.ts";
|
||||
import { DiscordChannel } from "../../deps.ts";
|
||||
|
||||
/** Delete a channel in your server. Bot needs MANAGE_CHANNEL permissions in the server. Bot needs MANAGE_THREADS permissions in the server if deleting thread. */
|
||||
export async function deleteChannel(bot: Bot, channelId: bigint, reason?: string) {
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { Bot } from "../../bot.ts";
|
||||
import { Bot } from "../../bot.ts";
|
||||
|
||||
/** Delete the channel permission overwrites for a user or role in this channel. Requires `MANAGE_ROLES` permission. */
|
||||
export async function deleteChannelOverwrite(bot: Bot, channelId: bigint, overwriteId: bigint) {
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { Bot } from "../../bot.ts";
|
||||
import { Bot } from "../../bot.ts";
|
||||
|
||||
/** Deletes the Stage instance. Requires the user to be a moderator of the Stage channel. */
|
||||
export async function deleteStageInstance(bot: Bot, channelId: bigint) {
|
||||
@@ -1,7 +1,6 @@
|
||||
import type { Bot } from "../../bot.ts";
|
||||
import { Bot } from "../../bot.ts";
|
||||
import { Channel } from "../../transformers/channel.ts";
|
||||
import { DiscordChannel } from "../../types/discord.ts";
|
||||
import { ChannelTypes, VideoQualityModes } from "../../types/shared.ts";
|
||||
import { ChannelTypes, DiscordChannel, VideoQualityModes } from "../../deps.ts";
|
||||
import { OverwriteReadable } from "./editChannelOverwrite.ts";
|
||||
|
||||
/** Update a channel's settings. Requires the `MANAGE_CHANNELS` permission for the guild. */
|
||||
@@ -1,5 +1,5 @@
|
||||
import type { Bot } from "../../bot.ts";
|
||||
import { OverwriteTypes, PermissionStrings } from "../../types/shared.ts";
|
||||
import { Bot } from "../../bot.ts";
|
||||
import { OverwriteTypes, PermissionStrings } from "../../deps.ts";
|
||||
|
||||
/** Edit the channel permission overwrites for a user or role in this channel. Requires `MANAGE_ROLES` permission. */
|
||||
export async function editChannelOverwrite(
|
||||
@@ -1,5 +1,5 @@
|
||||
import type { Bot } from "../../bot.ts";
|
||||
import { DiscordFollowedChannel } from "../../types/discord.ts";
|
||||
import { Bot } from "../../bot.ts";
|
||||
import { DiscordFollowedChannel } from "../../deps.ts";
|
||||
|
||||
/** Follow a News Channel to send messages to a target channel. Requires the `MANAGE_WEBHOOKS` permission in the target channel. Returns the webhook id. */
|
||||
export async function followChannel(bot: Bot, sourceChannelId: bigint, targetChannelId: bigint) {
|
||||
@@ -1,7 +1,7 @@
|
||||
import type { Bot } from "../../../bot.ts";
|
||||
import { DiscordChannel } from "../../../types/discord.ts";
|
||||
import { AllowedMentions, FileContent, MessageComponents } from "../../../types/mod.ts";
|
||||
import { Bot } from "../../../bot.ts";
|
||||
import { DiscordChannel, FileContent } from "../../../deps.ts";
|
||||
import { Embed } from "../../../transformers/embed.ts";
|
||||
import { AllowedMentions, MessageComponents } from "../../../typings.ts";
|
||||
|
||||
/** Creates a new public thread from an existing message. Returns a thread channel. */
|
||||
export async function createForumPost(
|
||||
@@ -1,5 +1,5 @@
|
||||
import type { Bot } from "../../bot.ts";
|
||||
import { DiscordChannel } from "../../types/discord.ts";
|
||||
import { Bot } from "../../bot.ts";
|
||||
import { DiscordChannel } from "../../deps.ts";
|
||||
|
||||
/** Fetches a single channel object from the api. */
|
||||
export async function getChannel(bot: Bot, channelId: bigint) {
|
||||
@@ -1,6 +1,6 @@
|
||||
import { Collection } from "../../util/collection.ts";
|
||||
import type { Bot } from "../../bot.ts";
|
||||
import { DiscordWebhook } from "../../types/discord.ts";
|
||||
import { BotCollection as Collection } from "../../util/collection.ts";
|
||||
import { Bot } from "../../bot.ts";
|
||||
import { DiscordWebhook } from "../../deps.ts";
|
||||
|
||||
/** Gets the webhooks for this channel. Requires MANAGE_WEBHOOKS */
|
||||
export async function getChannelWebhooks(bot: Bot, channelId: bigint) {
|
||||
@@ -1,6 +1,6 @@
|
||||
import { Collection } from "../../util/collection.ts";
|
||||
import type { Bot } from "../../bot.ts";
|
||||
import { DiscordChannel } from "../../types/discord.ts";
|
||||
import { BotCollection as Collection } from "../../util/collection.ts";
|
||||
import { Bot } from "../../bot.ts";
|
||||
import { DiscordChannel } from "../../deps.ts";
|
||||
|
||||
/** Returns a list of guild channel objects. */
|
||||
export async function getChannels(bot: Bot, guildId: bigint) {
|
||||
@@ -1,5 +1,5 @@
|
||||
import type { Bot } from "../../bot.ts";
|
||||
import { DiscordMessage } from "../../types/discord.ts";
|
||||
import { Bot } from "../../bot.ts";
|
||||
import { DiscordMessage } from "../../deps.ts";
|
||||
|
||||
/** Get pinned messages in this channel. */
|
||||
export async function getPins(bot: Bot, channelId: bigint) {
|
||||
@@ -1,5 +1,5 @@
|
||||
import type { Bot } from "../../bot.ts";
|
||||
import { DiscordStageInstance } from "../../types/discord.ts";
|
||||
import { Bot } from "../../bot.ts";
|
||||
import { DiscordStageInstance } from "../../deps.ts";
|
||||
|
||||
/** Gets the stage instance associated with the Stage channel, if it exists. */
|
||||
export async function getStageInstance(bot: Bot, channelId: bigint) {
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { Bot } from "../../bot.ts";
|
||||
import { Bot } from "../../bot.ts";
|
||||
|
||||
/**
|
||||
* Trigger a typing indicator for the specified channel. Generally bots should **NOT** implement this route.
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { Bot } from "../../bot.ts";
|
||||
import { Bot } from "../../bot.ts";
|
||||
|
||||
/** Modify the positions of channels on the guild. Requires MANAGE_CHANNELS permission. Only channels to be modified are required. */
|
||||
export async function swapChannels(bot: Bot, guildId: bigint, channelPositions: ModifyGuildChannelPositions[]) {
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user