mirror of
https://github.com/discordeno/discordeno.git
synced 2026-06-01 16:30:08 +00:00
import type fixes
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import type { DiscordPayload } from "../types/discord.ts";
|
||||
import type { GuildBanPayload } from "../types/guild.ts";
|
||||
|
||||
import { eventHandlers } from "../module/client.ts";
|
||||
import { DiscordPayload } from "../types/discord.ts";
|
||||
import { GuildBanPayload } from "../types/guild.ts";
|
||||
import { cacheHandlers } from "./cache.ts";
|
||||
|
||||
export async function handleInternalGuildBanAdd(data: DiscordPayload) {
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
import { Channel } from "../structures/channel.ts";
|
||||
import { Guild } from "../structures/guild.ts";
|
||||
import { Message } from "../structures/message.ts";
|
||||
import { PresenceUpdatePayload } from "../types/discord.ts";
|
||||
import type { Channel } from "../structures/channel.ts";
|
||||
import type { Guild } from "../structures/guild.ts";
|
||||
import type { Message } from "../structures/message.ts";
|
||||
import type { PresenceUpdatePayload } from "../types/discord.ts";
|
||||
import type { Collection } from "../utils/collection.ts";
|
||||
|
||||
import { cache } from "../utils/cache.ts";
|
||||
import { Collection } from "../utils/collection.ts";
|
||||
|
||||
export type TableName =
|
||||
| "guilds"
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
import { ChannelCreatePayload, ChannelTypes } from "../types/channel.ts";
|
||||
import { eventHandlers } from "../module/client.ts";
|
||||
import type { ChannelCreatePayload } from "../types/channel.ts";
|
||||
import type { DiscordPayload } from "../types/discord.ts";
|
||||
|
||||
import { ChannelTypes } from "../types/channel.ts";
|
||||
import { structures } from "../structures/mod.ts";
|
||||
import { DiscordPayload } from "../types/discord.ts";
|
||||
import { eventHandlers } from "../module/client.ts";
|
||||
import { cacheHandlers } from "./cache.ts";
|
||||
|
||||
export async function handleInternalChannelCreate(data: DiscordPayload) {
|
||||
|
||||
@@ -1,14 +1,15 @@
|
||||
import { cache } from "../utils/cache.ts";
|
||||
import { DiscordPayload } from "../types/discord.ts";
|
||||
import {
|
||||
import type { DiscordPayload } from "../types/discord.ts";
|
||||
import type { GuildUpdateChange } from "../types/options.ts";
|
||||
import type {
|
||||
CreateGuildPayload,
|
||||
GuildDeletePayload,
|
||||
GuildEmojisUpdatePayload,
|
||||
UpdateGuildPayload,
|
||||
} from "../types/guild.ts";
|
||||
|
||||
import { cache } from "../utils/cache.ts";
|
||||
import { structures } from "../structures/mod.ts";
|
||||
import { eventHandlers } from "../module/client.ts";
|
||||
import { GuildUpdateChange } from "../types/options.ts";
|
||||
import { cacheHandlers } from "./cache.ts";
|
||||
|
||||
export async function handleInternalGuildCreate(
|
||||
|
||||
@@ -1,12 +1,13 @@
|
||||
import { eventHandlers } from "../module/client.ts";
|
||||
import { structures } from "../structures/mod.ts";
|
||||
import { DiscordPayload } from "../types/discord.ts";
|
||||
import {
|
||||
import type { DiscordPayload } from "../types/discord.ts";
|
||||
import type {
|
||||
GuildBanPayload,
|
||||
GuildMemberAddPayload,
|
||||
GuildMemberChunkPayload,
|
||||
GuildMemberUpdatePayload,
|
||||
} from "../types/guild.ts";
|
||||
|
||||
import { eventHandlers } from "../module/client.ts";
|
||||
import { structures } from "../structures/mod.ts";
|
||||
import { cache } from "../utils/cache.ts";
|
||||
import { cacheHandlers } from "./cache.ts";
|
||||
|
||||
@@ -14,7 +15,7 @@ export async function handleInternalGuildMemberAdd(data: DiscordPayload) {
|
||||
if (data.t !== "GUILD_MEMBER_ADD") return;
|
||||
|
||||
const payload = data.d as GuildMemberAddPayload;
|
||||
const guild = await cacheHandlers.get("guilds", payload.guild_id)
|
||||
const guild = await cacheHandlers.get("guilds", payload.guild_id);
|
||||
if (!guild) return;
|
||||
|
||||
guild.memberCount++;
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
import { eventHandlers } from "../module/client.ts";
|
||||
import { structures } from "../structures/mod.ts";
|
||||
import { DiscordPayload } from "../types/discord.ts";
|
||||
import {
|
||||
import type { DiscordPayload } from "../types/discord.ts";
|
||||
import type {
|
||||
MessageCreateOptions,
|
||||
MessageDeletePayload,
|
||||
MessageDeleteBulkPayload,
|
||||
} from "../types/message.ts";
|
||||
|
||||
import { eventHandlers } from "../module/client.ts";
|
||||
import { structures } from "../structures/mod.ts";
|
||||
import { cacheHandlers } from "./cache.ts";
|
||||
|
||||
export async function handleInternalMessageCreate(data: DiscordPayload) {
|
||||
|
||||
@@ -1,8 +1,5 @@
|
||||
import { delay } from "https://deno.land/std@0.67.0/async/delay.ts";
|
||||
import { eventHandlers, setBotID } from "../module/client.ts";
|
||||
import { allowNextShard } from "../module/shardingManager.ts";
|
||||
import { structures } from "../structures/mod.ts";
|
||||
import {
|
||||
import type { UserPayload } from "../types/guild.ts";
|
||||
import type {
|
||||
DiscordPayload,
|
||||
PresenceUpdatePayload,
|
||||
ReadyPayload,
|
||||
@@ -10,7 +7,11 @@ import {
|
||||
VoiceStateUpdatePayload,
|
||||
WebhookUpdatePayload,
|
||||
} from "../types/discord.ts";
|
||||
import { UserPayload } from "../types/guild.ts";
|
||||
|
||||
import { allowNextShard } from "../module/shardingManager.ts";
|
||||
import { delay } from "https://deno.land/std@0.67.0/async/delay.ts";
|
||||
import { eventHandlers, setBotID } from "../module/client.ts";
|
||||
import { structures } from "../structures/mod.ts";
|
||||
import { cache } from "../utils/cache.ts";
|
||||
import { cacheHandlers } from "./cache.ts";
|
||||
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
import { botID, eventHandlers } from "../module/client.ts";
|
||||
import { structures } from "../structures/mod.ts";
|
||||
import { DiscordPayload } from "../types/discord.ts";
|
||||
import {
|
||||
import type { DiscordPayload } from "../types/discord.ts";
|
||||
import type {
|
||||
BaseMessageReactionPayload,
|
||||
MessageReactionPayload,
|
||||
MessageReactionRemoveEmojiPayload,
|
||||
} from "../types/message.ts";
|
||||
|
||||
import { botID, eventHandlers } from "../module/client.ts";
|
||||
import { structures } from "../structures/mod.ts";
|
||||
import { cacheHandlers } from "./cache.ts";
|
||||
|
||||
export async function handleInternalMessageReactionAdd(data: DiscordPayload) {
|
||||
|
||||
@@ -1,7 +1,11 @@
|
||||
import type { DiscordPayload } from "../types/discord.ts";
|
||||
import type {
|
||||
GuildRoleDeletePayload,
|
||||
GuildRolePayload,
|
||||
} from "../types/guild.ts";
|
||||
|
||||
import { eventHandlers } from "../module/client.ts";
|
||||
import { structures } from "../structures/mod.ts";
|
||||
import { DiscordPayload } from "../types/discord.ts";
|
||||
import { GuildRoleDeletePayload, GuildRolePayload } from "../types/guild.ts";
|
||||
import { cacheHandlers } from "./cache.ts";
|
||||
|
||||
export async function handleInternalGuildRoleCreate(data: DiscordPayload) {
|
||||
|
||||
@@ -1,9 +1,4 @@
|
||||
import { Permissions } from "../types/permission.ts";
|
||||
import { botHasChannelPermissions } from "../utils/permissions.ts";
|
||||
import { Errors } from "../types/errors.ts";
|
||||
import { RequestManager } from "../module/requestManager.ts";
|
||||
import { endpoints } from "../constants/discord.ts";
|
||||
import { MessageCreateOptions } from "../types/message.ts";
|
||||
import type { MessageCreateOptions } from "../types/message.ts";
|
||||
import {
|
||||
GetMessagesAfter,
|
||||
GetMessagesBefore,
|
||||
@@ -14,9 +9,15 @@ import {
|
||||
ChannelEditOptions,
|
||||
FollowedChannelPayload,
|
||||
} from "../types/channel.ts";
|
||||
import type { RawOverwrite } from "../types/guild.ts";
|
||||
|
||||
import { logYellow } from "../utils/logger.ts";
|
||||
import { endpoints } from "../constants/discord.ts";
|
||||
import { RequestManager } from "../module/requestManager.ts";
|
||||
import { Errors } from "../types/errors.ts";
|
||||
import { Permissions } from "../types/permission.ts";
|
||||
import { botHasChannelPermissions } from "../utils/permissions.ts";
|
||||
import { structures } from "../structures/mod.ts";
|
||||
import { RawOverwrite } from "../types/guild.ts";
|
||||
|
||||
/** Checks if a channel overwrite for a user id or a role id has permission in this channel */
|
||||
export function channelOverwriteHasPermission(
|
||||
|
||||
@@ -1,16 +1,10 @@
|
||||
import { Guild } from "../structures/guild.ts";
|
||||
import { formatImageURL } from "../utils/cdn.ts";
|
||||
import { botHasPermission } from "../utils/permissions.ts";
|
||||
import { RequestManager } from "../module/requestManager.ts";
|
||||
import { endpoints } from "../constants/discord.ts";
|
||||
import { Errors } from "../types/errors.ts";
|
||||
import { Permissions } from "../types/permission.ts";
|
||||
import type { Guild } from "../structures/guild.ts";
|
||||
import {
|
||||
ChannelCreatePayload,
|
||||
ChannelTypes,
|
||||
} from "../types/channel.ts";
|
||||
import { ImageFormats, ImageSize } from "../types/cdn.ts";
|
||||
import {
|
||||
import type { ImageFormats, ImageSize } from "../types/cdn.ts";
|
||||
import type {
|
||||
CreateEmojisOptions,
|
||||
PositionSwap,
|
||||
EditEmojisOptions,
|
||||
@@ -26,16 +20,23 @@ import {
|
||||
BannedUser,
|
||||
UserPayload,
|
||||
} from "../types/guild.ts";
|
||||
import { RoleData } from "../types/role.ts";
|
||||
import type { RoleData } from "../types/role.ts";
|
||||
import type { MemberCreatePayload } from "../types/member.ts";
|
||||
import type { Member } from "../structures/member.ts";
|
||||
|
||||
import { Collection } from "../utils/collection.ts";
|
||||
import { urlToBase64 } from "../utils/utils.ts";
|
||||
import { Intents } from "../types/options.ts";
|
||||
import { identifyPayload } from "../module/client.ts";
|
||||
import { requestAllMembers } from "../module/shardingManager.ts";
|
||||
import { MemberCreatePayload } from "../types/member.ts";
|
||||
import { Member } from "../structures/member.ts";
|
||||
import { urlToBase64 } from "../utils/utils.ts";
|
||||
import { Collection } from "../utils/collection.ts";
|
||||
import { botHasPermission } from "../utils/permissions.ts";
|
||||
import { RequestManager } from "../module/requestManager.ts";
|
||||
import { endpoints } from "../constants/discord.ts";
|
||||
import { Errors } from "../types/errors.ts";
|
||||
import { Permissions } from "../types/permission.ts";
|
||||
import { structures } from "../structures/mod.ts";
|
||||
import { cacheHandlers } from "../controllers/cache.ts";
|
||||
import { formatImageURL } from "../utils/cdn.ts";
|
||||
|
||||
/** Gets an array of all the channels ids that are the children of this category. */
|
||||
export function categoryChildrenIDs(guild: Guild, id: string) {
|
||||
|
||||
@@ -1,21 +1,25 @@
|
||||
import { Member } from "../structures/member.ts";
|
||||
import { ImageSize, ImageFormats } from "../types/cdn.ts";
|
||||
import type { Member } from "../structures/member.ts";
|
||||
import type { ImageSize, ImageFormats } from "../types/cdn.ts";
|
||||
import type {
|
||||
MessageContent,
|
||||
DMChannelCreatePayload,
|
||||
} from "../types/channel.ts";
|
||||
import type { EditMemberOptions } from "../types/member.ts";
|
||||
|
||||
import { sendMessage } from "./channel.ts";
|
||||
import { structures } from "../structures/mod.ts";
|
||||
import { cacheHandlers } from "../controllers/cache.ts";
|
||||
import { formatImageURL } from "../utils/cdn.ts";
|
||||
import { endpoints } from "../constants/discord.ts";
|
||||
import { botID } from "../module/client.ts";
|
||||
import { Permissions } from "../types/permission.ts";
|
||||
import { Errors } from "../types/errors.ts";
|
||||
import { RequestManager } from "../module/requestManager.ts";
|
||||
import {
|
||||
highestRole,
|
||||
higherRolePosition,
|
||||
botHasPermission,
|
||||
} from "../utils/permissions.ts";
|
||||
import { botID } from "../module/client.ts";
|
||||
import { Permissions } from "../types/permission.ts";
|
||||
import { Errors } from "../types/errors.ts";
|
||||
import { RequestManager } from "../module/requestManager.ts";
|
||||
import { MessageContent, DMChannelCreatePayload } from "../types/channel.ts";
|
||||
import { EditMemberOptions } from "../types/member.ts";
|
||||
import { sendMessage } from "./channel.ts";
|
||||
import { structures } from "../structures/mod.ts";
|
||||
import { cacheHandlers } from "../controllers/cache.ts";
|
||||
|
||||
/** The users custom avatar or the default avatar if you don't have a member object. */
|
||||
export function rawAvatarURL(
|
||||
|
||||
@@ -1,16 +1,17 @@
|
||||
import { Message } from "../structures/message.ts";
|
||||
import type { Message } from "../structures/message.ts";
|
||||
import type { MessageContent } from "../types/channel.ts";
|
||||
import type { UserPayload } from "../types/guild.ts";
|
||||
import type { MessageCreateOptions } from "../types/message.ts";
|
||||
|
||||
import { delay } from "https://deno.land/std@0.67.0/async/delay.ts";
|
||||
import { structures } from "../structures/mod.ts";
|
||||
import { cacheHandlers } from "../controllers/cache.ts";
|
||||
import { botID } from "../module/client.ts";
|
||||
import { Permissions } from "../types/permission.ts";
|
||||
import { Errors } from "../types/errors.ts";
|
||||
import { RequestManager } from "../module/requestManager.ts";
|
||||
import { endpoints } from "../constants/discord.ts";
|
||||
import { botHasChannelPermissions } from "../utils/permissions.ts";
|
||||
import { MessageContent } from "../types/channel.ts";
|
||||
import { UserPayload } from "../types/guild.ts";
|
||||
import { MessageCreateOptions } from "../types/message.ts";
|
||||
import { structures } from "../structures/mod.ts";
|
||||
import { cacheHandlers } from "../controllers/cache.ts";
|
||||
|
||||
/** Delete a message */
|
||||
export async function deleteMessage(
|
||||
|
||||
@@ -1,14 +1,15 @@
|
||||
import {
|
||||
import type {
|
||||
WebhookCreateOptions,
|
||||
WebhookPayload,
|
||||
ExecuteWebhookOptions,
|
||||
} from "../types/webhook.ts";
|
||||
import type { MessageCreateOptions } from "../types/message.ts";
|
||||
|
||||
import { botHasChannelPermissions } from "../utils/permissions.ts";
|
||||
import { Permissions } from "../types/permission.ts";
|
||||
import { Errors } from "../types/errors.ts";
|
||||
import { RequestManager } from "../module/requestManager.ts";
|
||||
import { endpoints } from "../constants/discord.ts";
|
||||
import { MessageCreateOptions } from "../types/message.ts";
|
||||
import { urlToBase64 } from "../utils/utils.ts";
|
||||
import { structures } from "../structures/mod.ts";
|
||||
|
||||
@@ -102,5 +103,5 @@ export async function executeWebhook(
|
||||
}
|
||||
|
||||
export function getWebhook(webhookID: string) {
|
||||
return RequestManager.get(endpoints.WEBHOOK_ID(webhookID))
|
||||
return RequestManager.get(endpoints.WEBHOOK_ID(webhookID));
|
||||
}
|
||||
|
||||
@@ -1,24 +1,22 @@
|
||||
import {
|
||||
DiscordBotGatewayData,
|
||||
GatewayOpcode,
|
||||
ReadyPayload,
|
||||
} from "../types/discord.ts";
|
||||
import {
|
||||
eventHandlers,
|
||||
botGatewayData,
|
||||
IdentifyPayload,
|
||||
} from "./client.ts";
|
||||
import { delay } from "https://deno.land/std@0.67.0/async/delay.ts";
|
||||
import type { DiscordBotGatewayData, ReadyPayload } from "../types/discord.ts";
|
||||
import type { IdentifyPayload } from "./client.ts";
|
||||
import {
|
||||
connectWebSocket,
|
||||
isWebSocketCloseEvent,
|
||||
WebSocket,
|
||||
} from "https://deno.land/std@0.67.0/ws/mod.ts";
|
||||
import { DiscordHeartbeatPayload } from "../types/discord.ts";
|
||||
import { logRed } from "../utils/logger.ts";
|
||||
import type { DiscordHeartbeatPayload } from "../types/discord.ts";
|
||||
import type { FetchMembersOptions } from "../types/guild.ts";
|
||||
import type { BotStatusRequest } from "../utils/utils.ts";
|
||||
|
||||
import { handleDiscordPayload } from "./shardingManager.ts";
|
||||
import { FetchMembersOptions } from "../types/guild.ts";
|
||||
import { BotStatusRequest } from "../utils/utils.ts";
|
||||
import { logRed } from "../utils/logger.ts";
|
||||
import { delay } from "https://deno.land/std@0.67.0/async/delay.ts";
|
||||
import { GatewayOpcode } from "../types/discord.ts";
|
||||
import {
|
||||
eventHandlers,
|
||||
botGatewayData,
|
||||
} from "./client.ts";
|
||||
|
||||
const basicShards = new Map<number, BasicShard>();
|
||||
const heartbeating = new Set<number>();
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
import { endpoints } from "../constants/discord.ts";
|
||||
import { DiscordBotGatewayData } from "../types/discord.ts";
|
||||
import { ClientOptions, EventHandlers } from "../types/options.ts";
|
||||
import { RequestManager } from "./requestManager.ts";
|
||||
import type { ClientOptions, EventHandlers } from "../types/options.ts";
|
||||
import type { DiscordBotGatewayData } from "../types/discord.ts";
|
||||
|
||||
import { spawnShards } from "./shardingManager.ts";
|
||||
import { endpoints } from "../constants/discord.ts";
|
||||
import { RequestManager } from "./requestManager.ts";
|
||||
|
||||
export let authorization = "";
|
||||
export let botID = "";
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
import { RequestMethod } from "../types/fetch.ts";
|
||||
import { authorization, eventHandlers } from "./client.ts";
|
||||
import { delay } from "https://deno.land/std@0.67.0/async/delay.ts";
|
||||
import { Errors } from "../types/errors.ts";
|
||||
import { HttpResponseCode } from "../types/discord.ts";
|
||||
import { logRed } from "../utils/logger.ts";
|
||||
import { authorization, eventHandlers } from "./client.ts";
|
||||
import { baseEndpoints } from "../constants/discord.ts";
|
||||
import type { RequestMethods } from "../types/fetch.ts";
|
||||
|
||||
import { Errors } from "../types/errors.ts";
|
||||
import { logRed } from "../utils/logger.ts";
|
||||
import { delay } from "https://deno.land/std@0.67.0/async/delay.ts";
|
||||
|
||||
const pathQueues: { [key: string]: QueuedRequest[] } = {};
|
||||
const ratelimitedPaths = new Map<string, RateLimitedPath>();
|
||||
@@ -121,23 +122,23 @@ processRateLimitedPaths();
|
||||
|
||||
export const RequestManager = {
|
||||
get: async (url: string, body?: unknown) => {
|
||||
return runMethod(RequestMethod.Get, url, body);
|
||||
return runMethod("get", url, body);
|
||||
},
|
||||
post: (url: string, body?: unknown) => {
|
||||
return runMethod(RequestMethod.Post, url, body);
|
||||
return runMethod("post", url, body);
|
||||
},
|
||||
delete: (url: string, body?: unknown) => {
|
||||
return runMethod(RequestMethod.Delete, url, body);
|
||||
return runMethod("delete", url, body);
|
||||
},
|
||||
patch: (url: string, body?: unknown) => {
|
||||
return runMethod(RequestMethod.Patch, url, body);
|
||||
return runMethod("patch", url, body);
|
||||
},
|
||||
put: (url: string, body?: unknown) => {
|
||||
return runMethod(RequestMethod.Put, url, body);
|
||||
return runMethod("put", url, body);
|
||||
},
|
||||
};
|
||||
|
||||
function createRequestBody(body: any, method: RequestMethod) {
|
||||
function createRequestBody(body: any, method: RequestMethods) {
|
||||
const headers: { [key: string]: string } = {
|
||||
Authorization: authorization,
|
||||
"User-Agent":
|
||||
@@ -156,7 +157,7 @@ function createRequestBody(body: any, method: RequestMethod) {
|
||||
form.append("payload_json", JSON.stringify({ ...body, file: undefined }));
|
||||
body.file = form;
|
||||
} else if (
|
||||
body && ![RequestMethod.Get, RequestMethod.Delete].includes(method)
|
||||
body && !["get", "delete"].includes(method)
|
||||
) {
|
||||
headers["Content-Type"] = "application/json";
|
||||
}
|
||||
@@ -184,7 +185,7 @@ async function checkRatelimits(url: string) {
|
||||
}
|
||||
|
||||
async function runMethod(
|
||||
method: RequestMethod,
|
||||
method: RequestMethods,
|
||||
url: string,
|
||||
body?: unknown,
|
||||
retryCount = 0,
|
||||
|
||||
@@ -1,18 +1,19 @@
|
||||
import {
|
||||
connectWebSocket,
|
||||
isWebSocketCloseEvent,
|
||||
WebSocket,
|
||||
} from "https://deno.land/std@0.67.0/ws/mod.ts";
|
||||
import {
|
||||
GatewayOpcode,
|
||||
import type { WebSocket } from "https://deno.land/std@0.67.0/ws/mod.ts";
|
||||
import type {
|
||||
DiscordBotGatewayData,
|
||||
DiscordHeartbeatPayload,
|
||||
ReadyPayload,
|
||||
} from "../types/discord.ts";
|
||||
import type { FetchMembersOptions } from "../types/guild.ts";
|
||||
import type { DebugArg } from "../types/options.ts";
|
||||
|
||||
import { GatewayOpcode } from "../types/discord.ts";
|
||||
import { logRed } from "../utils/logger.ts";
|
||||
import { FetchMembersOptions } from "../types/guild.ts";
|
||||
import { delay } from "https://deno.land/std@0.67.0/async/delay.ts";
|
||||
import { DebugArg } from "../types/options.ts";
|
||||
import {
|
||||
connectWebSocket,
|
||||
isWebSocketCloseEvent,
|
||||
} from "https://deno.land/std@0.67.0/ws/mod.ts";
|
||||
|
||||
let shardSocket: WebSocket;
|
||||
|
||||
|
||||
@@ -1,27 +1,26 @@
|
||||
import {
|
||||
import type { IdentifyPayload } from "./client.ts";
|
||||
import type { Guild } from "../structures/guild.ts";
|
||||
import type { FetchMembersOptions } from "../types/guild.ts";
|
||||
import type {
|
||||
DiscordBotGatewayData,
|
||||
DiscordPayload,
|
||||
GatewayOpcode,
|
||||
} from "../types/discord.ts";
|
||||
import {
|
||||
eventHandlers,
|
||||
botGatewayData,
|
||||
identifyPayload,
|
||||
IdentifyPayload,
|
||||
} from "./client.ts";
|
||||
import { delay } from "https://deno.land/std@0.67.0/async/delay.ts";
|
||||
import { Guild } from "../structures/guild.ts";
|
||||
import {
|
||||
FetchMembersOptions,
|
||||
} from "../types/guild.ts";
|
||||
import type { BotStatusRequest } from "../utils/utils.ts";
|
||||
|
||||
import { controllers } from "../controllers/mod.ts";
|
||||
import { cache } from "../utils/cache.ts";
|
||||
import {
|
||||
createBasicShard,
|
||||
requestGuildMembers,
|
||||
botGatewayStatusRequest,
|
||||
} from "./basicShard.ts";
|
||||
import { BotStatusRequest } from "../utils/utils.ts";
|
||||
import { controllers } from "../controllers/mod.ts";
|
||||
import {
|
||||
eventHandlers,
|
||||
botGatewayData,
|
||||
identifyPayload,
|
||||
} from "./client.ts";
|
||||
import { GatewayOpcode } from "../types/discord.ts";
|
||||
import { delay } from "https://deno.land/std@0.67.0/async/delay.ts";
|
||||
|
||||
let shardCounter = 0;
|
||||
let basicSharding = false;
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
import { ChannelCreatePayload } from "../types/channel.ts";
|
||||
import { calculatePermissions } from "../utils/permissions.ts";
|
||||
import type { ChannelCreatePayload } from "../types/channel.ts";
|
||||
import type { Unpromise } from "../types/misc.ts";
|
||||
|
||||
import { cacheHandlers } from "../controllers/cache.ts";
|
||||
import { Unpromise } from "../types/misc.ts";
|
||||
import { calculatePermissions } from "../utils/permissions.ts";
|
||||
|
||||
export async function createChannel(
|
||||
data: ChannelCreatePayload,
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
import { CreateGuildPayload } from "../types/guild.ts";
|
||||
import { Collection } from "../utils/collection.ts";
|
||||
import type { CreateGuildPayload } from "../types/guild.ts";
|
||||
import type { Member } from "./member.ts";
|
||||
import type { Unpromise } from "../types/misc.ts";
|
||||
|
||||
import { structures } from "./mod.ts";
|
||||
import { Member } from "./member.ts";
|
||||
import { Unpromise } from "../types/misc.ts";
|
||||
import { Collection } from "../utils/collection.ts";
|
||||
|
||||
export async function createGuild(data: CreateGuildPayload, shardID: number) {
|
||||
const {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { MemberCreatePayload } from "../types/member.ts";
|
||||
import { Unpromise } from "../types/misc.ts";
|
||||
import type { MemberCreatePayload } from "../types/member.ts";
|
||||
import type { Unpromise } from "../types/misc.ts";
|
||||
|
||||
export async function createMember(data: MemberCreatePayload, guildID: string) {
|
||||
const {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { MessageCreateOptions } from "../types/message.ts";
|
||||
import { Unpromise } from "../types/misc.ts";
|
||||
import type { MessageCreateOptions } from "../types/message.ts";
|
||||
import type { Unpromise } from "../types/misc.ts";
|
||||
|
||||
export async function createMessage(data: MessageCreateOptions) {
|
||||
const {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { Unpromise } from "../types/misc.ts";
|
||||
import { RoleData } from "../types/role.ts";
|
||||
import type { Unpromise } from "../types/misc.ts";
|
||||
import type { RoleData } from "../types/role.ts";
|
||||
|
||||
export async function createRole(data: RoleData) {
|
||||
return {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { Timestamps } from "./discord.ts";
|
||||
import type { Timestamps } from "./discord.ts";
|
||||
|
||||
export interface ActivityPayload {
|
||||
name: string;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { RawOverwrite, Overwrite } from "./guild.ts";
|
||||
import { Embed } from "./message.ts";
|
||||
import type { RawOverwrite, Overwrite } from "./guild.ts";
|
||||
import type { Embed } from "./message.ts";
|
||||
|
||||
export interface ChannelEditOptions {
|
||||
/** 2-100 character channel name. All */
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { Activity } from "./message.ts";
|
||||
import { ClientStatusPayload } from "./presence.ts";
|
||||
import { PartialUser, UserPayload } from "./guild.ts";
|
||||
import { MemberCreatePayload } from "./member.ts";
|
||||
import type { Activity } from "./message.ts";
|
||||
import type { ClientStatusPayload } from "./presence.ts";
|
||||
import type { PartialUser, UserPayload } from "./guild.ts";
|
||||
import type { MemberCreatePayload } from "./member.ts";
|
||||
|
||||
export interface DiscordPayload {
|
||||
/** OP code for the payload */
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
export const enum RequestMethod {
|
||||
Get = "get",
|
||||
Post = "post",
|
||||
Put = "put",
|
||||
Patch = "patch",
|
||||
Head = "head",
|
||||
Delete = "delete",
|
||||
}
|
||||
export type RequestMethods =
|
||||
| "get"
|
||||
| "post"
|
||||
| "put"
|
||||
| "patch"
|
||||
| "head"
|
||||
| "delete";
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
import { Emoji, StatusType } from "./discord.ts";
|
||||
import { Permission } from "./permission.ts";
|
||||
import { RoleData } from "./role.ts";
|
||||
import { MemberCreatePayload } from "./member.ts";
|
||||
import { Activity } from "./message.ts";
|
||||
import { ClientStatusPayload } from "./presence.ts";
|
||||
import { ChannelCreatePayload, ChannelTypes } from "./channel.ts";
|
||||
import type { Emoji, StatusType } from "./discord.ts";
|
||||
import type { Permission } from "./permission.ts";
|
||||
import type { RoleData } from "./role.ts";
|
||||
import type { MemberCreatePayload } from "./member.ts";
|
||||
import type { Activity } from "./message.ts";
|
||||
import type { ClientStatusPayload } from "./presence.ts";
|
||||
import type { ChannelCreatePayload, ChannelTypes } from "./channel.ts";
|
||||
|
||||
export interface GuildRolePayload {
|
||||
/** The id of the guild */
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { UserPayload } from "./guild.ts";
|
||||
import type { UserPayload } from "./guild.ts";
|
||||
|
||||
export interface EditMemberOptions {
|
||||
/** Value to set users nickname to. Requires MANAGE_NICKNAMES permission. */
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { UserPayload } from "./guild.ts";
|
||||
import { MemberCreatePayload } from "./member.ts";
|
||||
import { Channel } from "../structures/channel.ts";
|
||||
import { ChannelType } from "./channel.ts";
|
||||
import type { UserPayload } from "./guild.ts";
|
||||
import type { MemberCreatePayload } from "./member.ts";
|
||||
import type { Channel } from "../structures/channel.ts";
|
||||
import type { ChannelType } from "./channel.ts";
|
||||
|
||||
export interface MentionedUser extends UserPayload {
|
||||
member: MemberCreatePayload;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import {
|
||||
import type {
|
||||
Properties,
|
||||
Emoji,
|
||||
DiscordPayload,
|
||||
@@ -6,9 +6,9 @@ import {
|
||||
TypingStartPayload,
|
||||
VoiceStateUpdatePayload,
|
||||
} from "./discord.ts";
|
||||
import { Role } from "../structures/role.ts";
|
||||
import { Message } from "../structures/message.ts";
|
||||
import {
|
||||
import type { Role } from "../structures/role.ts";
|
||||
import type { Message } from "../structures/message.ts";
|
||||
import type {
|
||||
PartialMessage,
|
||||
ReactionPayload,
|
||||
BaseMessageReactionPayload,
|
||||
@@ -17,10 +17,10 @@ import {
|
||||
Attachment,
|
||||
MessageReactionUncachedPayload,
|
||||
} from "./message.ts";
|
||||
import { Channel } from "../structures/channel.ts";
|
||||
import { Guild } from "../structures/guild.ts";
|
||||
import { Member } from "../structures/member.ts";
|
||||
import { UserPayload } from "./guild.ts";
|
||||
import type { Channel } from "../structures/channel.ts";
|
||||
import type { Guild } from "../structures/guild.ts";
|
||||
import type { Member } from "../structures/member.ts";
|
||||
import type { UserPayload } from "./guild.ts";
|
||||
|
||||
export interface Fulfilled_Client_Options {
|
||||
token: string;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { StatusType } from "./discord.ts";
|
||||
import type { StatusType } from "./discord.ts";
|
||||
|
||||
export interface ClientStatusPayload {
|
||||
/** The user's status set for an active desktop (Windows, Linux, Mac) application session */
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { UserPayload } from "./guild.ts";
|
||||
import { Embed } from "./message.ts";
|
||||
import type { UserPayload } from "./guild.ts";
|
||||
import type { Embed } from "./message.ts";
|
||||
|
||||
export interface WebhookPayload {
|
||||
/** The id of the webhook */
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import { Collection } from "./collection.ts";
|
||||
import { Message } from "../structures/message.ts";
|
||||
import { Guild } from "../structures/guild.ts";
|
||||
import { Channel } from "../structures/channel.ts";
|
||||
import { PresenceUpdatePayload } from "../types/discord.ts";
|
||||
import type { Message } from "../structures/message.ts";
|
||||
import type { Guild } from "../structures/guild.ts";
|
||||
import type { Channel } from "../structures/channel.ts";
|
||||
import type { PresenceUpdatePayload } from "../types/discord.ts";
|
||||
|
||||
export interface CacheData {
|
||||
isReady: boolean;
|
||||
@@ -23,5 +23,3 @@ export const cache: CacheData = {
|
||||
presences: new Collection(),
|
||||
fetchAllMembersProcessingRequests: new Collection<string, Function>(),
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { ImageSize, ImageFormats } from "../types/cdn.ts";
|
||||
import type { ImageSize, ImageFormats } from "../types/cdn.ts";
|
||||
|
||||
export const formatImageURL = (
|
||||
url: string,
|
||||
|
||||
@@ -1,10 +1,9 @@
|
||||
import {
|
||||
Permission,
|
||||
Permissions,
|
||||
} from "../types/permission.ts";
|
||||
import type { Permission } from "../types/permission.ts";
|
||||
import type { Role } from "../structures/role.ts";
|
||||
import type { Guild } from "../structures/guild.ts";
|
||||
|
||||
import { Permissions } from "../types/permission.ts";
|
||||
import { botID } from "../module/client.ts";
|
||||
import { Role } from "../structures/role.ts";
|
||||
import { Guild } from "../structures/guild.ts";
|
||||
import { cacheHandlers } from "../controllers/cache.ts";
|
||||
|
||||
/** Checks if the member has this permission. If the member is an owner or has admin perms it will always be true. */
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { StatusType } from "../types/discord.ts";
|
||||
import type { StatusType } from "../types/discord.ts";
|
||||
|
||||
import { ActivityType } from "../types/activity.ts";
|
||||
import { sendGatewayCommand } from "../module/shardingManager.ts";
|
||||
import { encode } from "https://deno.land/std@0.67.0/encoding/base64.ts";
|
||||
|
||||
Reference in New Issue
Block a user