mirror of
https://github.com/discordeno/discordeno.git
synced 2026-06-03 01:10:07 +00:00
style: run eslint --fix
This commit is contained in:
@@ -45,14 +45,14 @@ import {
|
||||
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 } from "./transformers/team.js"
|
||||
import { ThreadMember, transformThreadMember } from "./transformers/threadMember.js"
|
||||
import { transformVoiceRegion } from "./transformers/voiceRegion.js"
|
||||
import { transformWebhook } from "./transformers/webhook.js"
|
||||
import { transformWelcomeScreen } from "./transformers/welcomeScreen.js"
|
||||
import { transformWidget } from "./transformers/widget.js"
|
||||
import { transformWidgetSettings } from "./transformers/widgetSettings.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,
|
||||
@@ -66,24 +66,7 @@ import {
|
||||
DiscordReady,
|
||||
DiscordStickerPack,
|
||||
DiscordTemplate
|
||||
} 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 {
|
||||
,
|
||||
DiscordActivity,
|
||||
DiscordApplication,
|
||||
DiscordApplicationCommand,
|
||||
@@ -115,9 +98,24 @@ import {
|
||||
DiscordVoiceState,
|
||||
DiscordWebhook,
|
||||
DiscordWelcomeScreen
|
||||
} from "./types/discord.js"
|
||||
} 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 { CreateShardManager } from './gateway/manager/shardManager.js'
|
||||
import {
|
||||
AllowedMentions,
|
||||
CreateApplicationCommand,
|
||||
@@ -125,7 +123,7 @@ import {
|
||||
ShardSocketCloseCodes,
|
||||
transformApplicationCommandOptionChoiceToDiscordApplicationCommandOptionChoice,
|
||||
transformApplicationCommandOptionToDiscordApplicationCommandOption
|
||||
} from "./mod.js"
|
||||
} from './mod.js'
|
||||
import {
|
||||
ApplicationCommandOptionChoice,
|
||||
transformApplicationCommandOptionChoice
|
||||
@@ -144,16 +142,10 @@ 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 { Team } from './transformers/team.js'
|
||||
import { VoiceRegions } from './transformers/voiceRegion.js'
|
||||
import { Webhook } from './transformers/webhook.js'
|
||||
import { WelcomeScreen } from './transformers/welcomeScreen.js'
|
||||
import { GuildWidget } from './transformers/widget.js'
|
||||
import { GuildWidgetSettings } from './transformers/widgetSettings.js'
|
||||
import { routes } from './util/routes.js'
|
||||
import { getBotIdFromToken, removeTokenPrefix } from './util/token.js'
|
||||
|
||||
export function createBot(options: CreateBotOptions): Bot {
|
||||
export function createBot (options: CreateBotOptions): Bot {
|
||||
const bot = {
|
||||
id: options.botId ?? getBotIdFromToken(options.token),
|
||||
applicationId: options.applicationId || options.botId || getBotIdFromToken(options.token),
|
||||
@@ -209,10 +201,10 @@ export function createBot(options: CreateBotOptions): Bot {
|
||||
return bot
|
||||
}
|
||||
|
||||
export function createEventHandlers(
|
||||
export function createEventHandlers (
|
||||
events: Partial<EventHandlers>
|
||||
): EventHandlers {
|
||||
function ignore() { }
|
||||
function ignore () { }
|
||||
|
||||
return {
|
||||
debug: events.debug ?? ignore,
|
||||
@@ -275,7 +267,7 @@ export function createEventHandlers(
|
||||
}
|
||||
}
|
||||
|
||||
export async function startBot(bot: Bot) {
|
||||
export async function startBot (bot: Bot) {
|
||||
if (Object.keys(bot.botGatewayData ?? {}).length === 0) {
|
||||
bot.gateway.gatewayBot = await bot.helpers.getGatewayBot()
|
||||
bot.gateway.lastShardId = bot.gateway.gatewayBot.shards - 1
|
||||
@@ -285,7 +277,7 @@ export async function startBot(bot: Bot) {
|
||||
bot.gateway.spawnShards()
|
||||
}
|
||||
|
||||
export function createUtils(options: Partial<HelperUtils>) {
|
||||
export function createUtils (options: Partial<HelperUtils>) {
|
||||
return {
|
||||
snowflakeToBigint,
|
||||
bigintToSnowflake,
|
||||
@@ -315,7 +307,7 @@ export interface HelperUtils {
|
||||
calculatePermissions: typeof calculatePermissions
|
||||
}
|
||||
|
||||
export async function stopBot(bot: Bot) {
|
||||
export async function stopBot (bot: Bot) {
|
||||
await bot.gateway.stop(ShardSocketCloseCodes.Shutdown, 'User requested bot stop')
|
||||
|
||||
return bot
|
||||
@@ -368,7 +360,7 @@ export type DefaultHelpers = typeof defaultHelpers
|
||||
// deno-lint-ignore no-empty-interface
|
||||
export interface Helpers extends DefaultHelpers { } // Use interface for declaration merging
|
||||
|
||||
export function createHelpers(
|
||||
export function createHelpers (
|
||||
bot: Bot,
|
||||
customHelpers?: Partial<Helpers>
|
||||
): FinalHelpers {
|
||||
@@ -390,7 +382,7 @@ export function createHelpers(
|
||||
return converted
|
||||
}
|
||||
|
||||
export function createBaseHelpers(options: Partial<Helpers>) {
|
||||
export function createBaseHelpers (options: Partial<Helpers>) {
|
||||
return {
|
||||
...defaultHelpers,
|
||||
...options
|
||||
@@ -465,7 +457,7 @@ export interface Transformers {
|
||||
template: (bot: Bot, payload: DiscordTemplate) => Template
|
||||
}
|
||||
|
||||
export function createTransformers(options: Partial<Transformers>) {
|
||||
export function createTransformers (options: Partial<Transformers>) {
|
||||
return {
|
||||
reverse: {
|
||||
allowedMentions: ((options.reverse?.allowedMentions) != null) || transformAllowedMentionsToDiscordAllowedMentions,
|
||||
@@ -755,7 +747,7 @@ export interface EventHandlers {
|
||||
) => unknown
|
||||
}
|
||||
|
||||
export function createBotConstants() {
|
||||
export function createBotConstants () {
|
||||
return {
|
||||
DISCORDENO_VERSION,
|
||||
USER_AGENT,
|
||||
@@ -827,12 +819,12 @@ export interface BotGatewayHandlerOptions {
|
||||
INTEGRATION_DELETE: typeof handlers.handleIntegrationDelete
|
||||
}
|
||||
|
||||
export function createBotGatewayHandlers(
|
||||
export function createBotGatewayHandlers (
|
||||
options: Partial<BotGatewayHandlerOptions>
|
||||
): Record<
|
||||
GatewayDispatchEventNames,
|
||||
(bot: Bot, data: DiscordGatewayPayload, shardId: number) => any
|
||||
> {
|
||||
> {
|
||||
return {
|
||||
// misc
|
||||
READY: options.READY ?? handlers.handleReady,
|
||||
@@ -931,7 +923,7 @@ export function createBotGatewayHandlers(
|
||||
|
||||
export type RemoveFirstFromTuple<T extends any[]> = T['length'] extends 0 ? []
|
||||
: ((...b: T) => void) extends (a: any, ...b: infer I) => void ? I
|
||||
: []
|
||||
: []
|
||||
export type FinalHelpers = {
|
||||
[K in keyof Helpers]: (
|
||||
...args: RemoveFirstFromTuple<Parameters<Helpers[K]>>
|
||||
|
||||
@@ -19,7 +19,7 @@ const rest = createRestManager({
|
||||
token,
|
||||
secretKey: REST_AUTHORIZATION_KEY,
|
||||
customUrl: PROXY_REST_URL,
|
||||
debug(text) {
|
||||
debug (text) {
|
||||
if (text.startsWith('[REST - RequestCreate]')) {
|
||||
const aaa = text.split(' ')
|
||||
const method = aaa[4]
|
||||
@@ -34,7 +34,7 @@ const rest = createRestManager({
|
||||
console.log('[POSSIBLE BUCKET ISSUE]')
|
||||
}
|
||||
},
|
||||
fetching(options) {
|
||||
fetching (options) {
|
||||
// console.log("[FETCHING]", options.method, options.url, Date.now() - col.get(options.method + options.url)!);
|
||||
}
|
||||
})
|
||||
@@ -52,7 +52,7 @@ for await (const conn of server) {
|
||||
handleRequest(conn)
|
||||
}
|
||||
|
||||
async function handleRequest(conn: Deno.Conn) {
|
||||
async function handleRequest (conn: Deno.Conn) {
|
||||
// This "upgrades" a network connection into an HTTP connection.
|
||||
const httpConn = Deno.serveHttp(conn)
|
||||
// Each request sent over the HTTP connection will be yielded as an async
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import { GatewayManager } from "./gatewayManager.js";
|
||||
import { GatewayManager } from './gatewayManager.js'
|
||||
|
||||
/** Handler used to determine max number of shards to use based upon the max concurrency. */
|
||||
export function calculateTotalShards(gateway: GatewayManager): number {
|
||||
export function calculateTotalShards (gateway: GatewayManager): number {
|
||||
// Bots under 100k servers do not have access to total shards.
|
||||
if (gateway.manager.totalShards < 100) return gateway.manager.totalShards;
|
||||
if (gateway.manager.totalShards < 100) return gateway.manager.totalShards
|
||||
|
||||
// Calculate a multiple of `maxConcurrency` which can be used to connect to the gateway.
|
||||
return Math.ceil(
|
||||
@@ -11,6 +11,6 @@ export function calculateTotalShards(gateway: GatewayManager): number {
|
||||
// If `maxConcurrency` is 1 we can safely use 16.
|
||||
(gateway.gatewayBot.sessionStartLimit.maxConcurrency === 1
|
||||
? 16
|
||||
: gateway.gatewayBot.sessionStartLimit.maxConcurrency),
|
||||
) * gateway.gatewayBot.sessionStartLimit.maxConcurrency;
|
||||
: gateway.gatewayBot.sessionStartLimit.maxConcurrency)
|
||||
) * gateway.gatewayBot.sessionStartLimit.maxConcurrency
|
||||
}
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
import { GatewayManager } from "./gatewayManager.js";
|
||||
import { GatewayManager } from './gatewayManager.js'
|
||||
|
||||
export function calculateWorkerId(manager: GatewayManager, shardId: number) {
|
||||
export function calculateWorkerId (manager: GatewayManager, shardId: number) {
|
||||
// Ignore decimal numbers.
|
||||
let workerId = Math.floor((shardId) / manager.shardsPerWorker);
|
||||
let workerId = Math.floor((shardId) / manager.shardsPerWorker)
|
||||
// If the workerId overflows the maximal allowed workers we by default just use to last worker.
|
||||
if (workerId >= manager.totalWorkers) {
|
||||
// The Id of the last available worker is total -1
|
||||
workerId = manager.totalWorkers - 1;
|
||||
workerId = manager.totalWorkers - 1
|
||||
}
|
||||
|
||||
return workerId;
|
||||
return workerId
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@ export type GatewayManager = ReturnType<typeof createGatewayManager>
|
||||
* provided, it will fallback to a default which should be suitable for most
|
||||
* bots.
|
||||
*/
|
||||
export function createGatewayManager(
|
||||
export function createGatewayManager (
|
||||
options: PickPartial<CreateGatewayManager, 'handleDiscordPayload' | 'gatewayBot' | 'gatewayConfig'>
|
||||
) {
|
||||
const prepareBucketsOverwritten = options.prepareBuckets ?? prepareBuckets
|
||||
@@ -49,11 +49,11 @@ export function createGatewayManager(
|
||||
* Those will be created when the `spawnShards` (which calls `prepareBuckets` under the hood) function gets called.
|
||||
*/
|
||||
buckets: new Collection<
|
||||
number,
|
||||
{
|
||||
workers: Array<{ id: number, queue: number[] }>
|
||||
leak: LeakyBucket
|
||||
}
|
||||
number,
|
||||
{
|
||||
workers: Array<{ id: number, queue: number[] }>
|
||||
leak: LeakyBucket
|
||||
}
|
||||
>(),
|
||||
/** Id of the first Shard which should get controlled by this manager.
|
||||
*
|
||||
@@ -231,11 +231,11 @@ export interface CreateGatewayManager {
|
||||
|
||||
/** Stored as bucketId: { workers: [workerId, [ShardIds]], createNextShard: boolean } */
|
||||
buckets: Collection<
|
||||
number,
|
||||
{
|
||||
workers: Array<{ id: number, queue: number[] }>
|
||||
leak: LeakyBucket
|
||||
}
|
||||
number,
|
||||
{
|
||||
workers: Array<{ id: number, queue: number[] }>
|
||||
leak: LeakyBucket
|
||||
}
|
||||
>
|
||||
// METHODS
|
||||
|
||||
|
||||
@@ -6,4 +6,3 @@ export * from './shardManager.js'
|
||||
export * from './spawnShards.js'
|
||||
export * from './stop.js'
|
||||
export * from './tellWorkerToIdentify.js'
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { createLeakyBucket } from '../../util/bucket.js'
|
||||
import { GatewayManager } from './gatewayManager.js'
|
||||
|
||||
export function prepareBuckets(gateway: GatewayManager) {
|
||||
export function prepareBuckets (gateway: GatewayManager) {
|
||||
for (let i = 0; i < gateway.gatewayBot.sessionStartLimit.maxConcurrency; ++i) {
|
||||
gateway.buckets.set(i, {
|
||||
workers: [],
|
||||
|
||||
@@ -9,7 +9,7 @@ import { GatewayManager } from './gatewayManager.js'
|
||||
|
||||
export type Resharder = ReturnType<typeof activateResharder>
|
||||
|
||||
export function activateResharder(options: ActivateResharderOptions) {
|
||||
export function activateResharder (options: ActivateResharderOptions) {
|
||||
const resharder = {
|
||||
// ----------
|
||||
// PROPERTIES
|
||||
@@ -107,7 +107,7 @@ export interface ActivateResharderOptions {
|
||||
}
|
||||
|
||||
/** Handler that by default will check to see if resharding should occur. Can be overridden if you have multiple servers and you want to communicate through redis pubsub or whatever you prefer. */
|
||||
export function activate(resharder: Resharder): void {
|
||||
export function activate (resharder: Resharder): void {
|
||||
if (resharder.intervalId !== undefined) {
|
||||
throw new Error('[RESHARDER] Cannot activate the resharder more than one time.')
|
||||
}
|
||||
@@ -133,7 +133,7 @@ export function activate(resharder: Resharder): void {
|
||||
}, resharder.checkInterval)
|
||||
}
|
||||
|
||||
export async function reshard(resharder: Resharder, gatewayBot: GetGatewayBot) {
|
||||
export async function reshard (resharder: Resharder, gatewayBot: GetGatewayBot) {
|
||||
console.log('[Resharding] Starting the reshard process.')
|
||||
|
||||
resharder.gateway.gatewayBot = gatewayBot
|
||||
@@ -157,16 +157,16 @@ export async function reshard(resharder: Resharder, gatewayBot: GetGatewayBot) {
|
||||
}
|
||||
|
||||
/** Handler that by default will save the new shard id for each guild this becomes ready in new gateway. This can be overridden to save the shard ids in a redis cache layer or whatever you prefer. These ids will be used later to update all guilds. */
|
||||
export async function markNewGuildShardId(guildIds: bigint[], shardId: number) {
|
||||
export async function markNewGuildShardId (guildIds: bigint[], shardId: number) {
|
||||
// PLACEHOLDER TO LET YOU MARK A GUILD ID AND SHARD ID FOR LATER USE ONCE RESHARDED
|
||||
}
|
||||
|
||||
/** Handler that by default does not do anything since by default the library will not cache. */
|
||||
export async function reshardingEditGuildShardIds() {
|
||||
export async function reshardingEditGuildShardIds () {
|
||||
// PLACEHOLDER TO LET YOU UPDATE CACHED GUILDS
|
||||
}
|
||||
|
||||
export async function tellWorkerToPrepare(resharder: Resharder, shardId: number) {
|
||||
export async function tellWorkerToPrepare (resharder: Resharder, shardId: number) {
|
||||
// First create a shard without identifyin.
|
||||
const shard = createShard({
|
||||
...resharder.gateway.manager.createShardOptions,
|
||||
@@ -210,7 +210,7 @@ export async function tellWorkerToPrepare(resharder: Resharder, shardId: number)
|
||||
resharder.shardIsPending(resharder, shard)
|
||||
}
|
||||
|
||||
export async function shardIsPending(resharder: Resharder, shard: Shard) {
|
||||
export async function shardIsPending (resharder: Resharder, shard: Shard) {
|
||||
// Save this in pending at the moment, until all shards are online
|
||||
resharder.pendingShards.set(shard.id, shard)
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@ export type ShardManager = ReturnType<typeof createShardManager>
|
||||
* This does not manage a specific range of Shard but the provided Shards on create or when an identify is requested.
|
||||
* The aim of this is to provide an easy to use manager which can be used by workers or any other kind of separate process.
|
||||
*/
|
||||
export function createShardManager(options: CreateShardManager) {
|
||||
export function createShardManager (options: CreateShardManager) {
|
||||
return {
|
||||
// ----------
|
||||
// PROPERTIES
|
||||
|
||||
@@ -1,16 +1,16 @@
|
||||
import { GatewayManager } from "./gatewayManager.js";
|
||||
import { GatewayManager } from './gatewayManager.js'
|
||||
|
||||
/** Begin spawning shards. */
|
||||
export function spawnShards(gateway: GatewayManager) {
|
||||
export function spawnShards (gateway: GatewayManager) {
|
||||
// PREPARES ALL SHARDS IN SPECIFIC BUCKETS
|
||||
gateway.prepareBuckets();
|
||||
gateway.prepareBuckets()
|
||||
|
||||
// SPREAD THIS OUT TO DIFFERENT WORKERS TO BEGIN STARTING UP
|
||||
gateway.buckets.forEach(async (bucket, bucketId) => {
|
||||
for (const worker of bucket.workers) {
|
||||
for (const shardId of worker.queue) {
|
||||
await gateway.tellWorkerToIdentify(worker.id, shardId, bucketId);
|
||||
await gateway.tellWorkerToIdentify(worker.id, shardId, bucketId)
|
||||
}
|
||||
}
|
||||
});
|
||||
})
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { delay } from '../../util/utils.js'
|
||||
import { GatewayManager } from './gatewayManager.js'
|
||||
|
||||
export async function stop(gateway: GatewayManager, code: number, reason: string) {
|
||||
export async function stop (gateway: GatewayManager, code: number, reason: string) {
|
||||
gateway.manager.shards.forEach((shard) => shard.close(code, reason))
|
||||
|
||||
await delay(5000)
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { GatewayManager } from './gatewayManager.js'
|
||||
|
||||
/** Allows users to hook in and change to communicate to different workers across different servers or anything they like. For example using redis pubsub to talk to other servers. */
|
||||
export async function tellWorkerToIdentify(
|
||||
export async function tellWorkerToIdentify (
|
||||
gateway: GatewayManager,
|
||||
_workerId: number,
|
||||
shardId: number,
|
||||
|
||||
@@ -1,3 +1,2 @@
|
||||
export * from './manager/mod.js'
|
||||
export * from './shard/mod.js'
|
||||
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import { Shard } from "./types.js";
|
||||
import { Shard } from './types.js'
|
||||
|
||||
export function calculateSafeRequests(shard: Shard) {
|
||||
export function calculateSafeRequests (shard: Shard) {
|
||||
// * 2 adds extra safety layer for discords OP 1 requests that we need to respond to
|
||||
const safeRequests = shard.maxRequestsPerRateLimitTick -
|
||||
Math.ceil(shard.rateLimitResetInterval / shard.heart.interval) * 2;
|
||||
Math.ceil(shard.rateLimitResetInterval / shard.heart.interval) * 2
|
||||
|
||||
return safeRequests < 0 ? 0 : safeRequests;
|
||||
return safeRequests < 0 ? 0 : safeRequests
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { Shard } from "./types.js";
|
||||
import { Shard } from './types.js'
|
||||
|
||||
export function close(shard: Shard, code: number, reason: string): void {
|
||||
if (shard.socket?.readyState !== WebSocket.OPEN) return;
|
||||
export function close (shard: Shard, code: number, reason: string): void {
|
||||
if (shard.socket?.readyState !== WebSocket.OPEN) return
|
||||
|
||||
return shard.socket?.close(code, reason);
|
||||
return shard.socket?.close(code, reason)
|
||||
}
|
||||
|
||||
@@ -1,44 +1,44 @@
|
||||
import { Shard, ShardState } from "./types.js";
|
||||
import { Shard, ShardState } from './types.js'
|
||||
|
||||
export async function connect(shard: Shard): Promise<void> {
|
||||
export async function connect (shard: Shard): Promise<void> {
|
||||
// Only set the shard to `Connecting` state,
|
||||
// if the connection request does not come from an identify or resume action.
|
||||
if (![ShardState.Identifying, ShardState.Resuming].includes(shard.state)) {
|
||||
shard.state = ShardState.Connecting;
|
||||
shard.state = ShardState.Connecting
|
||||
}
|
||||
shard.events.connecting?.(shard);
|
||||
shard.events.connecting?.(shard)
|
||||
|
||||
let url = new URL(shard.gatewayConfig.url);
|
||||
let url = new URL(shard.gatewayConfig.url)
|
||||
// If not connecting to a proxy but directly to discord need to handle resuming
|
||||
if (url.origin === "wss://gateway.discord.gg") {
|
||||
if (url.origin === 'wss://gateway.discord.gg') {
|
||||
if (shard.state === ShardState.Resuming) {
|
||||
url = new URL(shard.resumeGatewayUrl);
|
||||
url = new URL(shard.resumeGatewayUrl)
|
||||
}
|
||||
url.searchParams.set("v", shard.gatewayConfig.version.toString());
|
||||
url.searchParams.set("encoding", "json");
|
||||
url.searchParams.set('v', shard.gatewayConfig.version.toString())
|
||||
url.searchParams.set('encoding', 'json')
|
||||
}
|
||||
|
||||
const socket = new WebSocket(url.toString());
|
||||
const socket = new WebSocket(url.toString())
|
||||
|
||||
shard.socket = socket;
|
||||
shard.socket = socket
|
||||
|
||||
// TODO: proper event handling
|
||||
socket.onerror = (event) => console.log({ error: event });
|
||||
socket.onerror = (event) => console.log({ error: event })
|
||||
|
||||
socket.onclose = (event) => shard.handleClose(event);
|
||||
socket.onclose = async (event) => await shard.handleClose(event)
|
||||
|
||||
socket.onmessage = (message) => shard.handleMessage(message);
|
||||
socket.onmessage = async (message) => await shard.handleMessage(message)
|
||||
|
||||
return new Promise((resolve) => {
|
||||
return await new Promise((resolve) => {
|
||||
socket.onopen = () => {
|
||||
// Only set the shard to `Unidentified` state,
|
||||
// if the connection request does not come from an identify or resume action.
|
||||
if (![ShardState.Identifying, ShardState.Resuming].includes(shard.state)) {
|
||||
shard.state = ShardState.Unidentified;
|
||||
shard.state = ShardState.Unidentified
|
||||
}
|
||||
shard.events.connected?.(shard);
|
||||
shard.events.connected?.(shard)
|
||||
|
||||
resolve();
|
||||
};
|
||||
});
|
||||
resolve()
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
@@ -32,7 +32,7 @@ import {
|
||||
// TODO: improve shard event resolving
|
||||
|
||||
/** */
|
||||
export function createShard(
|
||||
export function createShard (
|
||||
options: CreateShard
|
||||
) {
|
||||
// This is done for performance reasons
|
||||
|
||||
@@ -1 +1 @@
|
||||
export { decompress_with as decompressWith } from "https://unpkg.com/@evan/wasm@0.0.94/target/zlib/deno.js";
|
||||
export { decompress_with as decompressWith } from 'https://unpkg.com/@evan/wasm@0.0.94/target/zlib/deno.js'
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { GatewayCloseEventCodes } from '../../types/shared.js'
|
||||
import { Shard, ShardSocketCloseCodes, ShardState } from './types.js'
|
||||
|
||||
export async function handleClose(shard: Shard, close: CloseEvent): Promise<void> {
|
||||
export async function handleClose (shard: Shard, close: CloseEvent): Promise<void> {
|
||||
// gateway.debug("GW CLOSED", { shardId, payload: event });
|
||||
|
||||
shard.stopHeartbeating()
|
||||
|
||||
@@ -7,7 +7,7 @@ import { GATEWAY_RATE_LIMIT_RESET_INTERVAL, Shard, ShardState } from './types.js
|
||||
|
||||
const decoder = new TextDecoder()
|
||||
|
||||
export async function handleMessage(shard: Shard, message: MessageEvent<any>): Promise<void> {
|
||||
export async function handleMessage (shard: Shard, message: MessageEvent<any>): Promise<void> {
|
||||
message = message.data
|
||||
|
||||
// If message compression is enabled,
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { GatewayOpcodes } from '../../types/shared.js'
|
||||
import { Shard, ShardSocketCloseCodes, ShardState } from './types.js'
|
||||
|
||||
export async function identify(shard: Shard): Promise<void> {
|
||||
export async function identify (shard: Shard): Promise<void> {
|
||||
// A new identify has been requested even though there is already a connection open.
|
||||
// Therefore we need to close the old connection and heartbeating before creating a new one.
|
||||
if (shard.isOpen()) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { Shard } from "./types.js";
|
||||
import { Shard } from './types.js'
|
||||
|
||||
export function isOpen(shard: Shard): boolean {
|
||||
return shard.socket?.readyState === WebSocket.OPEN;
|
||||
export function isOpen (shard: Shard): boolean {
|
||||
return shard.socket?.readyState === WebSocket.OPEN
|
||||
}
|
||||
|
||||
@@ -12,4 +12,3 @@ export * from './shutdown.js'
|
||||
export * from './startHeartbeating.js'
|
||||
export * from './stopHeartbeating.js'
|
||||
export * from './types.js'
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { GatewayOpcodes } from '../../types/shared.js'
|
||||
import { Shard, ShardSocketCloseCodes, ShardState } from './types.js'
|
||||
|
||||
export async function resume(shard: Shard): Promise<void> {
|
||||
export async function resume (shard: Shard): Promise<void> {
|
||||
// gateway.debug("GW RESUMING", { shardId });
|
||||
// It has been requested to resume the Shards session.
|
||||
// It's possible that the shard is still connected with Discord's gateway therefore we need to forcefully close it.
|
||||
|
||||
@@ -1,27 +1,27 @@
|
||||
import { Shard, ShardSocketRequest } from "./types.js";
|
||||
import { Shard, ShardSocketRequest } from './types.js'
|
||||
|
||||
async function checkOffline(shard: Shard, highPriority: boolean): Promise<void> {
|
||||
async function checkOffline (shard: Shard, highPriority: boolean): Promise<void> {
|
||||
if (!shard.isOpen()) {
|
||||
await new Promise((resolve) => {
|
||||
if (highPriority) {
|
||||
// Higher priority requests get added at the beginning of the array.
|
||||
shard.offlineSendQueue.unshift(resolve);
|
||||
shard.offlineSendQueue.unshift(resolve)
|
||||
} else {
|
||||
shard.offlineSendQueue.push(resolve);
|
||||
shard.offlineSendQueue.push(resolve)
|
||||
}
|
||||
});
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
export async function send(shard: Shard, message: ShardSocketRequest, highPriority: boolean): Promise<void> {
|
||||
export async function send (shard: Shard, message: ShardSocketRequest, highPriority: boolean): Promise<void> {
|
||||
// Before acquiring a token from the bucket, check whether the shard is currently offline or not.
|
||||
// Else bucket and token wait time just get wasted.
|
||||
await checkOffline(shard, highPriority);
|
||||
await checkOffline(shard, highPriority)
|
||||
|
||||
await shard.bucket.acquire(1, highPriority);
|
||||
await shard.bucket.acquire(1, highPriority)
|
||||
|
||||
// It's possible, that the shard went offline after a token has been acquired from the bucket.
|
||||
await checkOffline(shard, highPriority);
|
||||
await checkOffline(shard, highPriority)
|
||||
|
||||
shard.socket?.send(JSON.stringify(message));
|
||||
shard.socket?.send(JSON.stringify(message))
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { Shard, ShardSocketCloseCodes, ShardState } from "./types.js";
|
||||
import { Shard, ShardSocketCloseCodes, ShardState } from './types.js'
|
||||
|
||||
export async function shutdown(shard: Shard): Promise<void> {
|
||||
shard.close(ShardSocketCloseCodes.Shutdown, "Shard shutting down.");
|
||||
shard.state = ShardState.Offline;
|
||||
export async function shutdown (shard: Shard): Promise<void> {
|
||||
shard.close(ShardSocketCloseCodes.Shutdown, 'Shard shutting down.')
|
||||
shard.state = ShardState.Offline
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { GatewayOpcodes } from '../../types/shared.js'
|
||||
import { Shard, ShardSocketCloseCodes, ShardState } from './types.js'
|
||||
|
||||
export function startHeartbeating(shard: Shard, interval: number) {
|
||||
export function startHeartbeating (shard: Shard, interval: number) {
|
||||
// gateway.debug("GW HEARTBEATING_STARTED", { shardId, interval });
|
||||
|
||||
shard.heart.interval = interval
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import { Shard } from "./types.js";
|
||||
import { Shard } from './types.js'
|
||||
|
||||
export function stopHeartbeating(shard: Shard): void {
|
||||
export function stopHeartbeating (shard: Shard): void {
|
||||
// Clear the regular heartbeat interval.
|
||||
clearInterval(shard.heart.intervalId);
|
||||
clearInterval(shard.heart.intervalId)
|
||||
// It's possible that the Shard got closed before the first jittered heartbeat.
|
||||
// To go safe we should clear the related timeout too.
|
||||
clearTimeout(shard.heart.timeoutId);
|
||||
clearTimeout(shard.heart.timeoutId)
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import type { Bot } from '../../bot.js'
|
||||
import { DiscordChannel, DiscordGatewayPayload } from '../../types/discord.js'
|
||||
|
||||
export async function handleChannelCreate(bot: Bot, payload: DiscordGatewayPayload) {
|
||||
export async function handleChannelCreate (bot: Bot, payload: DiscordGatewayPayload) {
|
||||
const channel = bot.transformers.channel(bot, { channel: payload.d as DiscordChannel })
|
||||
|
||||
bot.events.channelCreate(bot, channel)
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import type { Bot } from '../../bot.js'
|
||||
import { DiscordChannel, DiscordGatewayPayload } from '../../types/discord.js'
|
||||
|
||||
export async function handleChannelDelete(bot: Bot, data: DiscordGatewayPayload) {
|
||||
export async function handleChannelDelete (bot: Bot, data: DiscordGatewayPayload) {
|
||||
const payload = data.d as DiscordChannel
|
||||
if (!payload.guild_id) return
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import type { Bot } from '../../bot.js'
|
||||
import { DiscordChannelPinsUpdate, DiscordGatewayPayload } from '../../types/discord.js'
|
||||
|
||||
export async function handleChannelPinsUpdate(bot: Bot, data: DiscordGatewayPayload) {
|
||||
export async function handleChannelPinsUpdate (bot: Bot, data: DiscordGatewayPayload) {
|
||||
const payload = data.d as DiscordChannelPinsUpdate
|
||||
|
||||
bot.events.channelPinsUpdate(bot, {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import type { Bot } from '../../bot.js'
|
||||
import { DiscordChannel, DiscordGatewayPayload } from '../../types/discord.js'
|
||||
|
||||
export async function handleChannelUpdate(bot: Bot, data: DiscordGatewayPayload) {
|
||||
export async function handleChannelUpdate (bot: Bot, data: DiscordGatewayPayload) {
|
||||
const payload = data.d as DiscordChannel
|
||||
const channel = bot.transformers.channel(bot, { channel: payload })
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import type { Bot } from '../../bot.js'
|
||||
import { DiscordGatewayPayload, DiscordStageInstance } from '../../types/discord.js'
|
||||
|
||||
export function handleStageInstanceCreate(bot: Bot, data: DiscordGatewayPayload) {
|
||||
export function handleStageInstanceCreate (bot: Bot, data: DiscordGatewayPayload) {
|
||||
const payload = data.d as DiscordStageInstance
|
||||
|
||||
bot.events.stageInstanceCreate(bot, {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import type { Bot } from '../../bot.js'
|
||||
import { DiscordGatewayPayload, DiscordStageInstance } from '../../types/discord.js'
|
||||
|
||||
export function handleStageInstanceDelete(bot: Bot, data: DiscordGatewayPayload) {
|
||||
export function handleStageInstanceDelete (bot: Bot, data: DiscordGatewayPayload) {
|
||||
const payload = data.d as DiscordStageInstance
|
||||
|
||||
bot.events.stageInstanceDelete(bot, {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import type { Bot } from '../../bot.js'
|
||||
import { DiscordGatewayPayload, DiscordStageInstance } from '../../types/discord.js'
|
||||
|
||||
export function handleStageInstanceUpdate(bot: Bot, data: DiscordGatewayPayload) {
|
||||
export function handleStageInstanceUpdate (bot: Bot, data: DiscordGatewayPayload) {
|
||||
const payload = data.d as DiscordStageInstance
|
||||
|
||||
bot.events.stageInstanceUpdate(bot, {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { Bot } from '../../bot.js'
|
||||
import { DiscordChannel, DiscordGatewayPayload } from '../../types/discord.js'
|
||||
|
||||
export async function handleThreadCreate(bot: Bot, data: DiscordGatewayPayload) {
|
||||
export async function handleThreadCreate (bot: Bot, data: DiscordGatewayPayload) {
|
||||
const payload = data.d as DiscordChannel
|
||||
|
||||
bot.events.threadCreate(bot, bot.transformers.channel(bot, { channel: payload }))
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { Bot } from '../../bot.js'
|
||||
import { DiscordChannel, DiscordGatewayPayload } from '../../types/discord.js'
|
||||
|
||||
export async function handleThreadDelete(bot: Bot, data: DiscordGatewayPayload) {
|
||||
export async function handleThreadDelete (bot: Bot, data: DiscordGatewayPayload) {
|
||||
const payload = data.d as DiscordChannel
|
||||
bot.events.threadDelete(bot, bot.transformers.channel(bot, { channel: payload }))
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { Bot } from '../../bot.js'
|
||||
import { DiscordGatewayPayload, DiscordThreadListSync } from '../../types/discord.js'
|
||||
|
||||
export async function handleThreadListSync(bot: Bot, data: DiscordGatewayPayload) {
|
||||
export async function handleThreadListSync (bot: Bot, data: DiscordGatewayPayload) {
|
||||
const payload = data.d as DiscordThreadListSync
|
||||
|
||||
const guildId = bot.transformers.snowflake(payload.guild_id)
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { Bot } from '../../bot.js'
|
||||
import { DiscordGatewayPayload, DiscordThreadMembersUpdate } from '../../types/discord.js'
|
||||
|
||||
export async function handleThreadMembersUpdate(bot: Bot, data: DiscordGatewayPayload) {
|
||||
export async function handleThreadMembersUpdate (bot: Bot, data: DiscordGatewayPayload) {
|
||||
const payload = data.d as DiscordThreadMembersUpdate
|
||||
bot.events.threadMembersUpdate(bot, {
|
||||
id: bot.transformers.snowflake(payload.id),
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { Bot } from '../../bot.js'
|
||||
import { DiscordGatewayPayload, DiscordThreadMemberUpdate } from '../../types/discord.js'
|
||||
|
||||
export async function handleThreadMemberUpdate(bot: Bot, data: DiscordGatewayPayload) {
|
||||
export async function handleThreadMemberUpdate (bot: Bot, data: DiscordGatewayPayload) {
|
||||
const payload = data.d as DiscordThreadMemberUpdate
|
||||
|
||||
bot.events.threadMemberUpdate(bot, {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { Bot } from '../../bot.js'
|
||||
import { DiscordChannel, DiscordGatewayPayload } from '../../types/discord.js'
|
||||
|
||||
export async function handleThreadUpdate(bot: Bot, data: DiscordGatewayPayload) {
|
||||
export async function handleThreadUpdate (bot: Bot, data: DiscordGatewayPayload) {
|
||||
const payload = data.d as DiscordChannel
|
||||
|
||||
bot.events.threadUpdate(bot, bot.transformers.channel(bot, { channel: payload }))
|
||||
|
||||
@@ -10,4 +10,3 @@ export * from './THREAD_DELETE.js'
|
||||
export * from './THREAD_LIST_SYNC.js'
|
||||
export * from './THREAD_MEMBERS_UPDATE.js'
|
||||
export * from './THREAD_UPDATE.js'
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@ 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) {
|
||||
export async function handleGuildEmojisUpdate (bot: Bot, data: DiscordGatewayPayload) {
|
||||
const payload = data.d as DiscordGuildEmojisUpdate
|
||||
|
||||
bot.events.guildEmojisUpdate(bot, {
|
||||
|
||||
@@ -1 +1 @@
|
||||
export * from "./GUILD_EMOJIS_UPDATE.js";
|
||||
export * from './GUILD_EMOJIS_UPDATE.js'
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import type { Bot } from '../../bot.js'
|
||||
import { DiscordGatewayPayload, DiscordGuildBanAddRemove } from '../../types/discord.js'
|
||||
|
||||
export async function handleGuildBanAdd(bot: Bot, data: DiscordGatewayPayload) {
|
||||
export async function handleGuildBanAdd (bot: Bot, data: DiscordGatewayPayload) {
|
||||
const payload = data.d as DiscordGuildBanAddRemove
|
||||
bot.events.guildBanAdd(bot, bot.transformers.user(bot, payload.user), bot.transformers.snowflake(payload.guild_id))
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import type { Bot } from '../../bot.js'
|
||||
import { DiscordGatewayPayload, DiscordGuildBanAddRemove } from '../../types/discord.js'
|
||||
|
||||
export async function handleGuildBanRemove(bot: Bot, data: DiscordGatewayPayload) {
|
||||
export async function handleGuildBanRemove (bot: Bot, data: DiscordGatewayPayload) {
|
||||
const payload = data.d as DiscordGuildBanAddRemove
|
||||
|
||||
await bot.events.guildBanRemove(
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import type { Bot } from '../../bot.js'
|
||||
import { DiscordGatewayPayload, DiscordGuild } from '../../types/discord.js'
|
||||
|
||||
export function handleGuildCreate(bot: Bot, data: DiscordGatewayPayload, shardId: number) {
|
||||
export function handleGuildCreate (bot: Bot, data: DiscordGatewayPayload, shardId: number) {
|
||||
const payload = data.d as DiscordGuild
|
||||
bot.events.guildCreate(bot, bot.transformers.guild(bot, { guild: payload, shardId }))
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import type { Bot } from '../../bot.js'
|
||||
import { DiscordGatewayPayload, DiscordUnavailableGuild } from '../../types/discord.js'
|
||||
|
||||
export async function handleGuildDelete(bot: Bot, data: DiscordGatewayPayload, shardId: number) {
|
||||
export async function handleGuildDelete (bot: Bot, data: DiscordGatewayPayload, shardId: number) {
|
||||
const payload = data.d as DiscordUnavailableGuild
|
||||
bot.events.guildDelete(bot, bot.transformers.snowflake(payload.id), shardId)
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import type { Bot } from '../../bot.js'
|
||||
import { DiscordGatewayPayload, DiscordGuildIntegrationsUpdate } from '../../types/discord.js'
|
||||
|
||||
export async function handleGuildIntegrationsUpdate(bot: Bot, data: DiscordGatewayPayload) {
|
||||
export async function handleGuildIntegrationsUpdate (bot: Bot, data: DiscordGatewayPayload) {
|
||||
const payload = data.d as DiscordGuildIntegrationsUpdate
|
||||
|
||||
bot.events.integrationUpdate(bot, { guildId: bot.transformers.snowflake(payload.guild_id) })
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import type { Bot } from '../../bot.js'
|
||||
import { DiscordGatewayPayload, DiscordGuild } from '../../types/discord.js'
|
||||
|
||||
export function handleGuildUpdate(bot: Bot, data: DiscordGatewayPayload, shardId: number) {
|
||||
export function handleGuildUpdate (bot: Bot, data: DiscordGatewayPayload, shardId: number) {
|
||||
const payload = data.d as DiscordGuild
|
||||
|
||||
bot.events.guildUpdate(bot, bot.transformers.guild(bot, { guild: payload, shardId }))
|
||||
|
||||
@@ -2,7 +2,7 @@ import type { Bot } from '../../../bot.js'
|
||||
import { DiscordAutoModerationActionExecution, DiscordGatewayPayload } from '../../../types/discord.js'
|
||||
|
||||
/** Requires the MANAGE_GUILD permission. */
|
||||
export function handleAutoModerationActionExecution(bot: Bot, data: DiscordGatewayPayload, shardId: number) {
|
||||
export function handleAutoModerationActionExecution (bot: Bot, data: DiscordGatewayPayload, shardId: number) {
|
||||
const payload = data.d as DiscordAutoModerationActionExecution
|
||||
bot.events.automodActionExecution(bot, bot.transformers.automodActionExecution(bot, payload))
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@ import type { Bot } from '../../../bot.js'
|
||||
import { DiscordAutoModerationRule, DiscordGatewayPayload } from '../../../types/discord.js'
|
||||
|
||||
/** Requires the MANAGE_GUILD permission. */
|
||||
export function handleAutoModerationRuleCreate(bot: Bot, data: DiscordGatewayPayload, shardId: number) {
|
||||
export function handleAutoModerationRuleCreate (bot: Bot, data: DiscordGatewayPayload, shardId: number) {
|
||||
const payload = data.d as DiscordAutoModerationRule
|
||||
bot.events.automodRuleCreate(bot, bot.transformers.automodRule(bot, payload))
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@ import type { Bot } from '../../../bot.js'
|
||||
import { DiscordAutoModerationRule, DiscordGatewayPayload } from '../../../types/discord.js'
|
||||
|
||||
/** Requires the MANAGE_GUILD permission. */
|
||||
export function handleAutoModerationRuleDelete(bot: Bot, data: DiscordGatewayPayload, shardId: number) {
|
||||
export function handleAutoModerationRuleDelete (bot: Bot, data: DiscordGatewayPayload, shardId: number) {
|
||||
const payload = data.d as DiscordAutoModerationRule
|
||||
bot.events.automodRuleDelete(bot, bot.transformers.automodRule(bot, payload))
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@ import type { Bot } from '../../../bot.js'
|
||||
import { DiscordAutoModerationRule, DiscordGatewayPayload } from '../../../types/discord.js'
|
||||
|
||||
/** Requires the MANAGE_GUILD permission. */
|
||||
export function handleAutoModerationRuleUpdate(bot: Bot, data: DiscordGatewayPayload, shardId: number) {
|
||||
export function handleAutoModerationRuleUpdate (bot: Bot, data: DiscordGatewayPayload, shardId: number) {
|
||||
const payload = data.d as DiscordAutoModerationRule
|
||||
bot.events.automodRuleUpdate(bot, bot.transformers.automodRule(bot, payload))
|
||||
}
|
||||
|
||||
@@ -5,5 +5,3 @@ export * from './GUILD_DELETE.js'
|
||||
export * from './GUILD_INTEGRATIONS_UPDATE.js'
|
||||
export * from './GUILD_UPDATE.js'
|
||||
export * from './scheduledEvents/mod.js'
|
||||
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import type { Bot } from '../../../bot.js'
|
||||
import { DiscordGatewayPayload, DiscordScheduledEvent } from '../../../types/discord.js'
|
||||
|
||||
export function handleGuildScheduledEventCreate(bot: Bot, data: DiscordGatewayPayload, shardId: number) {
|
||||
export function handleGuildScheduledEventCreate (bot: Bot, data: DiscordGatewayPayload, shardId: number) {
|
||||
const payload = data.d as DiscordScheduledEvent
|
||||
bot.events.scheduledEventCreate(bot, bot.transformers.scheduledEvent(bot, payload))
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import type { Bot } from '../../../bot.js'
|
||||
import { DiscordGatewayPayload, DiscordScheduledEvent } from '../../../types/discord.js'
|
||||
|
||||
export function handleGuildScheduledEventDelete(bot: Bot, data: DiscordGatewayPayload) {
|
||||
export function handleGuildScheduledEventDelete (bot: Bot, data: DiscordGatewayPayload) {
|
||||
const payload = data.d as DiscordScheduledEvent
|
||||
bot.events.scheduledEventDelete(bot, bot.transformers.scheduledEvent(bot, payload))
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import type { Bot } from "../../../bot.js";
|
||||
import { DiscordGatewayPayload, DiscordScheduledEvent } from "../../../types/discord.js";
|
||||
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;
|
||||
bot.events.scheduledEventUpdate(bot, bot.transformers.scheduledEvent(bot, payload));
|
||||
export function handleGuildScheduledEventUpdate (bot: Bot, data: DiscordGatewayPayload) {
|
||||
const payload = data.d as DiscordScheduledEvent
|
||||
bot.events.scheduledEventUpdate(bot, bot.transformers.scheduledEvent(bot, payload))
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import type { Bot } from '../../../bot.js'
|
||||
import { DiscordGatewayPayload, DiscordScheduledEventUserAdd } from '../../../types/discord.js'
|
||||
|
||||
export function handleGuildScheduledEventUserAdd(bot: Bot, data: DiscordGatewayPayload) {
|
||||
export function handleGuildScheduledEventUserAdd (bot: Bot, data: DiscordGatewayPayload) {
|
||||
const payload = data.d as DiscordScheduledEventUserAdd
|
||||
|
||||
return bot.events.scheduledEventUserAdd(bot, {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import type { Bot } from '../../../bot.js'
|
||||
import { DiscordGatewayPayload, DiscordScheduledEventUserRemove } from '../../../types/discord.js'
|
||||
|
||||
export function handleGuildScheduledEventUserRemove(bot: Bot, data: DiscordGatewayPayload) {
|
||||
export function handleGuildScheduledEventUserRemove (bot: Bot, data: DiscordGatewayPayload) {
|
||||
const payload = data.d as DiscordScheduledEventUserRemove
|
||||
|
||||
return bot.events.scheduledEventUserRemove(bot, {
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
export * from "./GUILD_SCHEDULED_EVENT_CREATE.js";
|
||||
export * from "./GUILD_SCHEDULED_EVENT_DELETE.js";
|
||||
export * from "./GUILD_SCHEDULED_EVENT_UPDATE.js";
|
||||
export * from "./GUILD_SCHEDULED_EVENT_USER_ADD.js";
|
||||
export * from "./GUILD_SCHEDULED_EVENT_USER_REMOVE.js";
|
||||
|
||||
export * from './GUILD_SCHEDULED_EVENT_CREATE.js'
|
||||
export * from './GUILD_SCHEDULED_EVENT_DELETE.js'
|
||||
export * from './GUILD_SCHEDULED_EVENT_UPDATE.js'
|
||||
export * from './GUILD_SCHEDULED_EVENT_USER_ADD.js'
|
||||
export * from './GUILD_SCHEDULED_EVENT_USER_REMOVE.js'
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { Bot } from '../../bot.js'
|
||||
import { DiscordGatewayPayload, DiscordIntegrationCreateUpdate } from '../../types/discord.js'
|
||||
|
||||
export function handleIntegrationCreate(bot: Bot, data: DiscordGatewayPayload) {
|
||||
export function handleIntegrationCreate (bot: Bot, data: DiscordGatewayPayload) {
|
||||
bot.events.integrationCreate(
|
||||
bot,
|
||||
bot.transformers.integration(bot, data.d as DiscordIntegrationCreateUpdate)
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { Bot } from '../../bot.js'
|
||||
import { DiscordGatewayPayload, DiscordIntegrationDelete } from '../../types/discord.js'
|
||||
|
||||
export function handleIntegrationDelete(bot: Bot, data: DiscordGatewayPayload) {
|
||||
export function handleIntegrationDelete (bot: Bot, data: DiscordGatewayPayload) {
|
||||
const payload = data.d as DiscordIntegrationDelete
|
||||
|
||||
bot.events.integrationDelete(bot, {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { Bot } from '../../bot.js'
|
||||
import { DiscordGatewayPayload, DiscordIntegrationCreateUpdate } from '../../types/discord.js'
|
||||
|
||||
export function handleIntegrationUpdate(bot: Bot, data: DiscordGatewayPayload) {
|
||||
export function handleIntegrationUpdate (bot: Bot, data: DiscordGatewayPayload) {
|
||||
bot.events.integrationUpdate(
|
||||
bot,
|
||||
bot.transformers.integration(bot, data.d as DiscordIntegrationCreateUpdate)
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
export * from "./INTEGRATION_CREATE.js";
|
||||
export * from "./INTEGRATION_DELETE.js";
|
||||
export * from "./INTEGRATION_UPDATE.js";
|
||||
|
||||
export * from './INTEGRATION_CREATE.js'
|
||||
export * from './INTEGRATION_DELETE.js'
|
||||
export * from './INTEGRATION_UPDATE.js'
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { Bot } from '../../bot.js'
|
||||
import { DiscordGatewayPayload, DiscordInteraction } from '../../types/discord.js'
|
||||
|
||||
export async function handleInteractionCreate(bot: Bot, data: DiscordGatewayPayload) {
|
||||
export async function handleInteractionCreate (bot: Bot, data: DiscordGatewayPayload) {
|
||||
bot.cache.unrepliedInteractions.add(bot.transformers.snowflake((data.d as DiscordInteraction).id))
|
||||
bot.events.interactionCreate(bot, bot.transformers.interaction(bot, data.d as DiscordInteraction))
|
||||
}
|
||||
|
||||
@@ -1 +1 @@
|
||||
export * from "./INTERACTION_CREATE.js";
|
||||
export * from './INTERACTION_CREATE.js'
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { Bot } from '../../bot.js'
|
||||
import { DiscordGatewayPayload, DiscordInviteCreate } from '../../types/discord.js'
|
||||
|
||||
export function handleInviteCreate(bot: Bot, data: DiscordGatewayPayload) {
|
||||
export function handleInviteCreate (bot: Bot, data: DiscordGatewayPayload) {
|
||||
bot.events.inviteCreate(bot, bot.transformers.invite(bot, data.d as DiscordInviteCreate))
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { Bot } from '../../bot.js'
|
||||
import { DiscordGatewayPayload, DiscordInviteDelete } from '../../types/discord.js'
|
||||
|
||||
export function handleInviteDelete(bot: Bot, data: DiscordGatewayPayload) {
|
||||
export function handleInviteDelete (bot: Bot, data: DiscordGatewayPayload) {
|
||||
const payload = data.d as DiscordInviteDelete
|
||||
|
||||
bot.events.inviteDelete(bot, {
|
||||
|
||||
@@ -1,3 +1,2 @@
|
||||
export * from './INVITE_CREATE.js'
|
||||
export * from './INVITE_DELETE.js'
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@ 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) {
|
||||
export async function handleGuildMembersChunk (bot: Bot, data: DiscordGatewayPayload) {
|
||||
const payload = data.d as DiscordGuildMembersChunk
|
||||
|
||||
const guildId = bot.transformers.snowflake(payload.guild_id)
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { Bot } from '../../bot.js'
|
||||
import { DiscordGatewayPayload, DiscordGuildMemberAdd } from '../../types/discord.js'
|
||||
|
||||
export async function handleGuildMemberAdd(bot: Bot, data: DiscordGatewayPayload) {
|
||||
export async function handleGuildMemberAdd (bot: Bot, data: DiscordGatewayPayload) {
|
||||
const payload = data.d as DiscordGuildMemberAdd
|
||||
const guildId = bot.transformers.snowflake(payload.guild_id)
|
||||
const user = bot.transformers.user(bot, payload.user)
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { Bot } from '../../bot.js'
|
||||
import { DiscordGatewayPayload, DiscordGuildMemberRemove } from '../../types/discord.js'
|
||||
|
||||
export async function handleGuildMemberRemove(bot: Bot, data: DiscordGatewayPayload) {
|
||||
export async function handleGuildMemberRemove (bot: Bot, data: DiscordGatewayPayload) {
|
||||
const payload = data.d as DiscordGuildMemberRemove
|
||||
const guildId = bot.transformers.snowflake(payload.guild_id)
|
||||
const user = bot.transformers.user(bot, payload.user)
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { Bot } from '../../bot.js'
|
||||
import { DiscordGatewayPayload, DiscordGuildMemberUpdate } from '../../types/discord.js'
|
||||
|
||||
export async function handleGuildMemberUpdate(bot: Bot, data: DiscordGatewayPayload) {
|
||||
export async function handleGuildMemberUpdate (bot: Bot, data: DiscordGatewayPayload) {
|
||||
const payload = data.d as DiscordGuildMemberUpdate
|
||||
|
||||
const user = bot.transformers.user(bot, payload.user)
|
||||
|
||||
@@ -2,4 +2,3 @@ export * from './GUILD_MEMBERS_CHUNK.js'
|
||||
export * from './GUILD_MEMBER_ADD.js'
|
||||
export * from './GUILD_MEMBER_REMOVE.js'
|
||||
export * from './GUILD_MEMBER_UPDATE.js'
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { Bot } from '../../bot.js'
|
||||
import { DiscordGatewayPayload, DiscordMessage } from '../../types/discord.js'
|
||||
|
||||
export async function handleMessageCreate(bot: Bot, data: DiscordGatewayPayload) {
|
||||
export async function handleMessageCreate (bot: Bot, data: DiscordGatewayPayload) {
|
||||
const payload = data.d as DiscordMessage
|
||||
|
||||
bot.events.messageCreate(bot, bot.transformers.message(bot, payload))
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { Bot } from '../../bot.js'
|
||||
import { DiscordGatewayPayload, DiscordMessageDelete } from '../../types/discord.js'
|
||||
|
||||
export async function handleMessageDelete(bot: Bot, data: DiscordGatewayPayload) {
|
||||
export async function handleMessageDelete (bot: Bot, data: DiscordGatewayPayload) {
|
||||
const payload = data.d as DiscordMessageDelete
|
||||
|
||||
bot.events.messageDelete(bot, {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { Bot } from '../../bot.js'
|
||||
import { DiscordGatewayPayload, DiscordMessageDeleteBulk } from '../../types/discord.js'
|
||||
|
||||
export async function handleMessageDeleteBulk(bot: Bot, data: DiscordGatewayPayload) {
|
||||
export async function handleMessageDeleteBulk (bot: Bot, data: DiscordGatewayPayload) {
|
||||
const payload = data.d as DiscordMessageDeleteBulk
|
||||
|
||||
const channelId = bot.transformers.snowflake(payload.channel_id)
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { Bot } from '../../bot.js'
|
||||
import { DiscordGatewayPayload, DiscordMessageReactionAdd } from '../../types/discord.js'
|
||||
|
||||
export async function handleMessageReactionAdd(bot: Bot, data: DiscordGatewayPayload) {
|
||||
export async function handleMessageReactionAdd (bot: Bot, data: DiscordGatewayPayload) {
|
||||
const payload = data.d as DiscordMessageReactionAdd
|
||||
|
||||
const guildId = payload.guild_id ? bot.transformers.snowflake(payload.guild_id) : undefined
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { Bot } from '../../bot.js'
|
||||
import { DiscordGatewayPayload, DiscordMessageReactionRemove } from '../../types/discord.js'
|
||||
|
||||
export async function handleMessageReactionRemove(bot: Bot, data: DiscordGatewayPayload) {
|
||||
export async function handleMessageReactionRemove (bot: Bot, data: DiscordGatewayPayload) {
|
||||
const payload = data.d as DiscordMessageReactionRemove
|
||||
|
||||
bot.events.reactionRemove(bot, {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { Bot } from '../../bot.js'
|
||||
import { DiscordGatewayPayload, DiscordMessageReactionRemoveAll } from '../../types/discord.js'
|
||||
|
||||
export async function handleMessageReactionRemoveAll(bot: Bot, data: DiscordGatewayPayload) {
|
||||
export async function handleMessageReactionRemoveAll (bot: Bot, data: DiscordGatewayPayload) {
|
||||
const payload = data.d as DiscordMessageReactionRemoveAll
|
||||
|
||||
bot.events.reactionRemoveAll(bot, {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { Bot } from '../../bot.js'
|
||||
import { DiscordGatewayPayload, DiscordMessageReactionRemoveEmoji } from '../../types/discord.js'
|
||||
|
||||
export async function handleMessageReactionRemoveEmoji(bot: Bot, data: DiscordGatewayPayload) {
|
||||
export async function handleMessageReactionRemoveEmoji (bot: Bot, data: DiscordGatewayPayload) {
|
||||
const payload = data.d as DiscordMessageReactionRemoveEmoji
|
||||
|
||||
bot.events.reactionRemoveEmoji(bot, {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { Bot } from '../../bot.js'
|
||||
import { DiscordGatewayPayload, DiscordMessage } from '../../types/discord.js'
|
||||
|
||||
export async function handleMessageUpdate(bot: Bot, data: DiscordGatewayPayload) {
|
||||
export async function handleMessageUpdate (bot: Bot, data: DiscordGatewayPayload) {
|
||||
const payload = data.d as DiscordMessage
|
||||
if (!payload.edited_timestamp) return
|
||||
|
||||
|
||||
@@ -6,4 +6,3 @@ export * from './MESSAGE_REACTION_REMOVE.js'
|
||||
export * from './MESSAGE_REACTION_REMOVE_ALL.js'
|
||||
export * from './MESSAGE_REACTION_REMOVE_EMOJI.js'
|
||||
export * from './MESSAGE_UPDATE.js'
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { Bot } from '../../bot.js'
|
||||
import { DiscordGatewayPayload, DiscordPresenceUpdate } from '../../types/discord.js'
|
||||
|
||||
export async function handlePresenceUpdate(bot: Bot, data: DiscordGatewayPayload) {
|
||||
export async function handlePresenceUpdate (bot: Bot, data: DiscordGatewayPayload) {
|
||||
bot.events.presenceUpdate(bot, bot.transformers.presence(bot, data.d as DiscordPresenceUpdate))
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { Bot } from '../../bot.js'
|
||||
import { DiscordGatewayPayload, DiscordReady } from '../../types/discord.js'
|
||||
|
||||
export function handleReady(bot: Bot, data: DiscordGatewayPayload, shardId: number) {
|
||||
export function handleReady (bot: Bot, data: DiscordGatewayPayload, shardId: number) {
|
||||
const payload = data.d as DiscordReady
|
||||
// Triggered on each shard
|
||||
bot.events.ready(
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { Bot } from '../../bot.js'
|
||||
import { DiscordGatewayPayload, DiscordTypingStart } from '../../types/discord.js'
|
||||
|
||||
export function handleTypingStart(bot: Bot, data: DiscordGatewayPayload) {
|
||||
export function handleTypingStart (bot: Bot, data: DiscordGatewayPayload) {
|
||||
const payload = data.d as DiscordTypingStart
|
||||
|
||||
const guildId = payload.guild_id ? bot.transformers.snowflake(payload.guild_id) : undefined
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { Bot } from '../../bot.js'
|
||||
import { DiscordGatewayPayload, DiscordUser } from '../../types/discord.js'
|
||||
|
||||
export async function handleUserUpdate(bot: Bot, data: DiscordGatewayPayload) {
|
||||
export async function handleUserUpdate (bot: Bot, data: DiscordGatewayPayload) {
|
||||
const payload = data.d as DiscordUser
|
||||
bot.events.botUpdate(bot, bot.transformers.user(bot, payload))
|
||||
}
|
||||
|
||||
@@ -2,4 +2,3 @@ export * from './PRESENCE_UPDATE.js'
|
||||
export * from './READY.js'
|
||||
export * from './TYPING_START.js'
|
||||
export * from './USER_UPDATE.js'
|
||||
|
||||
|
||||
@@ -10,4 +10,3 @@ export * from './misc/mod.js'
|
||||
export * from './roles/mod.js'
|
||||
export * from './voice/mod.js'
|
||||
export * from './webhooks/mod.js'
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { Bot } from '../../bot.js'
|
||||
import { DiscordGatewayPayload, DiscordGuildRoleCreate } from '../../types/discord.js'
|
||||
|
||||
export async function handleGuildRoleCreate(bot: Bot, data: DiscordGatewayPayload) {
|
||||
export async function handleGuildRoleCreate (bot: Bot, data: DiscordGatewayPayload) {
|
||||
const payload = data.d as DiscordGuildRoleCreate
|
||||
bot.events.roleCreate(
|
||||
bot,
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { Bot } from '../../bot.js'
|
||||
import { DiscordGatewayPayload, DiscordGuildRoleDelete } from '../../types/discord.js'
|
||||
|
||||
export async function handleGuildRoleDelete(bot: Bot, data: DiscordGatewayPayload) {
|
||||
export async function handleGuildRoleDelete (bot: Bot, data: DiscordGatewayPayload) {
|
||||
const payload = data.d as DiscordGuildRoleDelete
|
||||
bot.events.roleDelete(bot, {
|
||||
roleId: bot.transformers.snowflake(payload.role_id),
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { Bot } from '../../bot.js'
|
||||
import { DiscordGatewayPayload, DiscordGuildRoleUpdate } from '../../types/discord.js'
|
||||
|
||||
export async function handleGuildRoleUpdate(bot: Bot, data: DiscordGatewayPayload) {
|
||||
export async function handleGuildRoleUpdate (bot: Bot, data: DiscordGatewayPayload) {
|
||||
const payload = data.d as DiscordGuildRoleUpdate
|
||||
|
||||
bot.events.roleUpdate(
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
export * from './GUILD_ROLE_CREATE.js'
|
||||
export * from './GUILD_ROLE_DELETE.js'
|
||||
export * from './GUILD_ROLE_UPDATE.js'
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { Bot } from '../../bot.js'
|
||||
import { DiscordGatewayPayload, DiscordVoiceServerUpdate } from '../../types/discord.js'
|
||||
|
||||
export async function handleVoiceServerUpdate(bot: Bot, data: DiscordGatewayPayload) {
|
||||
export async function handleVoiceServerUpdate (bot: Bot, data: DiscordGatewayPayload) {
|
||||
const payload = data.d as DiscordVoiceServerUpdate
|
||||
|
||||
bot.events.voiceServerUpdate(bot, {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { Bot } from '../../bot.js'
|
||||
import { DiscordGatewayPayload, DiscordVoiceState } from '../../types/discord.js'
|
||||
|
||||
export async function handleVoiceStateUpdate(bot: Bot, data: DiscordGatewayPayload) {
|
||||
export async function handleVoiceStateUpdate (bot: Bot, data: DiscordGatewayPayload) {
|
||||
const payload = data.d as DiscordVoiceState
|
||||
if (!payload.guild_id) return
|
||||
|
||||
|
||||
@@ -1,3 +1,2 @@
|
||||
export * from './VOICE_SERVER_UPDATE.js'
|
||||
export * from './VOICE_STATE_UPDATE.js'
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { Bot } from '../../bot.js'
|
||||
import { DiscordGatewayPayload, DiscordWebhookUpdate } from '../../types/discord.js'
|
||||
|
||||
export function handleWebhooksUpdate(bot: Bot, data: DiscordGatewayPayload) {
|
||||
export function handleWebhooksUpdate (bot: Bot, data: DiscordGatewayPayload) {
|
||||
const payload = data.d as DiscordWebhookUpdate
|
||||
bot.events.webhooksUpdate(bot, {
|
||||
channelId: bot.transformers.snowflake(payload.channel_id),
|
||||
|
||||
@@ -1 +1 @@
|
||||
export * from "./WEBHOOKS_UPDATE.js";
|
||||
export * from './WEBHOOKS_UPDATE.js'
|
||||
|
||||
@@ -17,7 +17,7 @@ import { BigString } from '../../../types/shared.js'
|
||||
*
|
||||
* @see {@link https://discord.com/developers/docs/resources/channel#follow-announcement-channel}
|
||||
*/
|
||||
export async function followAnnouncementChannel(
|
||||
export async function followAnnouncementChannel (
|
||||
bot: Bot,
|
||||
sourceChannelId: BigString,
|
||||
targetChannelId: BigString
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user