mirror of
https://github.com/discordeno/discordeno.git
synced 2026-05-21 02:40:08 +00:00
Fix merge conflicts
This commit is contained in:
12
.github/PULL_REQUEST_TEMPLATE.md
vendored
12
.github/PULL_REQUEST_TEMPLATE.md
vendored
@@ -1,7 +1,11 @@
|
||||
## Description
|
||||
**Please describe the changes this PR makes and why it should be merged:**
|
||||
|
||||
<!-- Describe the changes you made. -->
|
||||
**Status**
|
||||
|
||||
## Issues
|
||||
- [ ] Code changes have been tested against the Discord API, or there are no code changes
|
||||
|
||||
<!-- Link any relevant issues here if you like? -->
|
||||
**Semantic versioning classification:**
|
||||
|
||||
- [ ] This PR changes the library's interface (methods or parameters added)
|
||||
- [ ] This PR includes breaking changes (methods removed or renamed, parameters moved or removed)
|
||||
- [ ] This PR **only** includes non-code changes, like changes to documentation, README, etc.
|
||||
|
||||
3
.vscode/settings.json
vendored
3
.vscode/settings.json
vendored
@@ -6,5 +6,6 @@
|
||||
},
|
||||
"editor.codeActionsOnSave": {
|
||||
"source.organizeImports": true
|
||||
}
|
||||
},
|
||||
"editor.defaultFormatter": "denoland.vscode-deno"
|
||||
}
|
||||
|
||||
40
README.md
40
README.md
@@ -1,14 +1,13 @@
|
||||
# Discordeno
|
||||
|
||||
Discord API library wrapper in Deno
|
||||
> Discord API library wrapper in Deno
|
||||
|
||||
[Discord Server](https://discord.gg/J4NqJ72)
|
||||
[](https://discord.gg/J4NqJ72)
|
||||

|
||||
[](https://nest.land/package/Discordeno)
|
||||
|
||||
[Website](https://discordeno.netlify.app)
|
||||
|
||||
[](https://nest.land/package/Discordeno)
|
||||

|
||||
|
||||
## Beginner Developers
|
||||
|
||||
Don't worry a lot of developers start out coding their first projects as a Discord bot(I did 😉) and it is not so easy. With Discordeno, I tried to build it in a way that solved all the headaches I had when first starting out coding bots. If you are a beginner developer, please use a boilerplate: The official one is at: [GitHub](https://github.com/Skillz4Killz/Discordeno-bot-template) but there will be more listed on the website. It is a beautiful website indeed! Check it out!
|
||||
@@ -43,12 +42,15 @@ Don't worry a lot of developers start out coding their first projects as a Disco
|
||||
- Supports nested folders to keep cleaner translation files
|
||||
|
||||
**Hot Reloadable**
|
||||
- Easily update your code without having to restart the bot everytime.
|
||||
|
||||
- Easily update your code without having to restart the bot everytime.
|
||||
|
||||
**Step By Step Guide**
|
||||
- There is a step by step walkthrough to learn how to create Discord bots with Discordeno on our website!
|
||||
|
||||
- There is a step by step walkthrough to learn how to create Discord bots with Discordeno on our website!
|
||||
|
||||
## Advanced Developers
|
||||
|
||||
The instructions below are meant for advanced developers!
|
||||
|
||||
Starting with Discordeno is very simple, you can start from scratch without any boilerplates/frameworks: Add this snippet of code into a new TypeScript file:
|
||||
@@ -60,18 +62,18 @@ import { Intents } from "https://x.nest.land/Discordeno@9.0.1/src/types/options.
|
||||
import config from "./config.ts";
|
||||
|
||||
StartBot({
|
||||
token: config.token,
|
||||
intents: [Intents.GUILD_MESSAGES, Intents.GUILDS],
|
||||
eventHandlers: {
|
||||
ready: () => {
|
||||
console.log(`Logged!`);
|
||||
},
|
||||
messageCreate: (message) => {
|
||||
if (message.content === "!ping") {
|
||||
sendMessage(message.channelID, "Pong");
|
||||
}
|
||||
}
|
||||
}
|
||||
token: config.token,
|
||||
intents: [Intents.GUILD_MESSAGES, Intents.GUILDS],
|
||||
eventHandlers: {
|
||||
ready: () => {
|
||||
console.log(`Logged!`);
|
||||
},
|
||||
messageCreate: (message) => {
|
||||
if (message.content === "!ping") {
|
||||
sendMessage(message.channelID, "Pong");
|
||||
}
|
||||
},
|
||||
},
|
||||
});
|
||||
```
|
||||
|
||||
|
||||
@@ -66,7 +66,7 @@ const config = {
|
||||
title: "Discordeno",
|
||||
description: "Easy Deno module for Discord API interactions..",
|
||||
ogImage: "https://i.imgur.com/7O5E6hI.png",
|
||||
docsLocation: "https://github.com/Skillz4Killz/Discordeno",
|
||||
docsLocation: "https://github.com/Skillz4Killz/Discordeno/tree/master/docs/content",
|
||||
favicon: "",
|
||||
},
|
||||
pwa: {
|
||||
|
||||
25
mod.ts
25
mod.ts
@@ -1,6 +1,5 @@
|
||||
import createClient from "./src/module/client.ts";
|
||||
|
||||
export * from "./src/controllers/mod.ts";
|
||||
export * from "./src/controllers/bans.ts";
|
||||
export * from "./src/controllers/cache.ts";
|
||||
export * from "./src/controllers/channels.ts";
|
||||
@@ -8,26 +7,23 @@ export * from "./src/controllers/guilds.ts";
|
||||
export * from "./src/controllers/members.ts";
|
||||
export * from "./src/controllers/messages.ts";
|
||||
export * from "./src/controllers/misc.ts";
|
||||
export * from "./src/controllers/mod.ts";
|
||||
export * from "./src/controllers/reactions.ts";
|
||||
export * from "./src/controllers/roles.ts";
|
||||
|
||||
export * from "./src/module/client.ts";
|
||||
export * from "./src/module/requestManager.ts";
|
||||
export * from "./src/module/shardingManager.ts";
|
||||
|
||||
export * from "./src/structures/mod.ts";
|
||||
export * from "./src/structures/channel.ts";
|
||||
export * from "./src/structures/guild.ts";
|
||||
export * from "./src/structures/member.ts";
|
||||
export * from "./src/structures/message.ts";
|
||||
export * from "./src/structures/role.ts";
|
||||
|
||||
export * from "./src/handlers/channel.ts";
|
||||
export * from "./src/handlers/guild.ts";
|
||||
export * from "./src/handlers/member.ts";
|
||||
export * from "./src/handlers/message.ts";
|
||||
export * from "./src/handlers/webhook.ts";
|
||||
|
||||
export * from "./src/module/client.ts";
|
||||
export * from "./src/module/requestManager.ts";
|
||||
export * from "./src/module/shardingManager.ts";
|
||||
export * from "./src/structures/channel.ts";
|
||||
export * from "./src/structures/guild.ts";
|
||||
export * from "./src/structures/member.ts";
|
||||
export * from "./src/structures/message.ts";
|
||||
export * from "./src/structures/mod.ts";
|
||||
export * from "./src/structures/role.ts";
|
||||
export * from "./src/types/activity.ts";
|
||||
export * from "./src/types/cdn.ts";
|
||||
export * from "./src/types/channel.ts";
|
||||
@@ -41,7 +37,6 @@ export * from "./src/types/options.ts";
|
||||
export * from "./src/types/permission.ts";
|
||||
export * from "./src/types/presence.ts";
|
||||
export * from "./src/types/role.ts";
|
||||
|
||||
export * from "./src/utils/cache.ts";
|
||||
export * from "./src/utils/cdn.ts";
|
||||
export * from "./src/utils/collection.ts";
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import { eventHandlers } from "../module/client.ts";
|
||||
import type { DiscordPayload } from "../types/discord.ts";
|
||||
import type { GuildBanPayload } from "../types/guild.ts";
|
||||
|
||||
import { eventHandlers } from "../module/client.ts";
|
||||
import { cacheHandlers } from "./cache.ts";
|
||||
|
||||
export async function handleInternalGuildBanAdd(data: DiscordPayload) {
|
||||
|
||||
@@ -2,9 +2,8 @@ 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 type { Collection } from "../utils/collection.ts";
|
||||
|
||||
export type TableName =
|
||||
| "guilds"
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
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 { eventHandlers } from "../module/client.ts";
|
||||
import { structures } from "../structures/mod.ts";
|
||||
import type { ChannelCreatePayload } from "../types/channel.ts";
|
||||
import { ChannelTypes } from "../types/channel.ts";
|
||||
import type { DiscordPayload } from "../types/discord.ts";
|
||||
import { cacheHandlers } from "./cache.ts";
|
||||
|
||||
export async function handleInternalChannelCreate(data: DiscordPayload) {
|
||||
|
||||
@@ -1,15 +1,14 @@
|
||||
import { eventHandlers } from "../module/client.ts";
|
||||
import { structures } from "../structures/mod.ts";
|
||||
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 type { GuildUpdateChange } from "../types/options.ts";
|
||||
import { cache } from "../utils/cache.ts";
|
||||
import { structures } from "../structures/mod.ts";
|
||||
import { eventHandlers } from "../module/client.ts";
|
||||
import { cacheHandlers } from "./cache.ts";
|
||||
|
||||
export async function handleInternalGuildCreate(
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
import { eventHandlers } from "../module/client.ts";
|
||||
import { structures } from "../structures/mod.ts";
|
||||
import type { DiscordPayload } from "../types/discord.ts";
|
||||
import type {
|
||||
GuildBanPayload,
|
||||
@@ -5,9 +7,6 @@ import type {
|
||||
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";
|
||||
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
import type { UserPayload } from "../types/guild.ts";
|
||||
import { delay } from "../../deps.ts";
|
||||
import { eventHandlers, setBotID } from "../module/client.ts";
|
||||
import { allowNextShard } from "../module/shardingManager.ts";
|
||||
import { structures } from "../structures/mod.ts";
|
||||
import type {
|
||||
DiscordPayload,
|
||||
PresenceUpdatePayload,
|
||||
@@ -7,11 +10,7 @@ import type {
|
||||
VoiceStateUpdatePayload,
|
||||
WebhookUpdatePayload,
|
||||
} from "../types/discord.ts";
|
||||
|
||||
import { allowNextShard } from "../module/shardingManager.ts";
|
||||
import { delay } from "../../deps.ts";
|
||||
import { eventHandlers, setBotID } from "../module/client.ts";
|
||||
import { structures } from "../structures/mod.ts";
|
||||
import type { UserPayload } from "../types/guild.ts";
|
||||
import { cache } from "../utils/cache.ts";
|
||||
import { cacheHandlers } from "./cache.ts";
|
||||
|
||||
|
||||
@@ -1,12 +1,11 @@
|
||||
import { botID, eventHandlers } from "../module/client.ts";
|
||||
import { structures } from "../structures/mod.ts";
|
||||
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,11 +1,10 @@
|
||||
import { eventHandlers } from "../module/client.ts";
|
||||
import { structures } from "../structures/mod.ts";
|
||||
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 { cacheHandlers } from "./cache.ts";
|
||||
|
||||
export async function handleInternalGuildRoleCreate(data: DiscordPayload) {
|
||||
|
||||
@@ -1,22 +1,21 @@
|
||||
import type { MessageCreateOptions } from "../types/message.ts";
|
||||
import type {
|
||||
GetMessagesAfter,
|
||||
GetMessagesBefore,
|
||||
GetMessagesAround,
|
||||
GetMessages,
|
||||
MessageContent,
|
||||
CreateInviteOptions,
|
||||
ChannelEditOptions,
|
||||
FollowedChannelPayload,
|
||||
} from "../types/channel.ts";
|
||||
import type { RawOverwrite } from "../types/guild.ts";
|
||||
|
||||
import { endpoints } from "../constants/discord.ts";
|
||||
import { RequestManager } from "../module/requestManager.ts";
|
||||
import { structures } from "../structures/mod.ts";
|
||||
import type {
|
||||
ChannelEditOptions,
|
||||
CreateInviteOptions,
|
||||
FollowedChannelPayload,
|
||||
GetMessages,
|
||||
GetMessagesAfter,
|
||||
GetMessagesAround,
|
||||
GetMessagesBefore,
|
||||
MessageContent,
|
||||
} from "../types/channel.ts";
|
||||
import { Errors } from "../types/errors.ts";
|
||||
import type { RawOverwrite } from "../types/guild.ts";
|
||||
import type { MessageCreateOptions } from "../types/message.ts";
|
||||
import { Permissions } from "../types/permission.ts";
|
||||
import { botHasChannelPermissions } from "../utils/permissions.ts";
|
||||
import { structures } from "../structures/mod.ts";
|
||||
|
||||
/** Checks if a channel overwrite for a user id or a role id has permission in this channel */
|
||||
export function channelOverwriteHasPermission(
|
||||
|
||||
@@ -1,43 +1,49 @@
|
||||
import { endpoints } from "../constants/discord.ts";
|
||||
import { cacheHandlers } from "../controllers/cache.ts";
|
||||
import { identifyPayload } from "../module/client.ts";
|
||||
import { RequestManager } from "../module/requestManager.ts";
|
||||
import { requestAllMembers } from "../module/shardingManager.ts";
|
||||
import type { Guild } from "../structures/guild.ts";
|
||||
import type { Member } from "../structures/member.ts";
|
||||
import { structures } from "../structures/mod.ts";
|
||||
import type { ImageFormats, ImageSize } from "../types/cdn.ts";
|
||||
import {
|
||||
ChannelCreatePayload,
|
||||
ChannelTypes,
|
||||
} from "../types/channel.ts";
|
||||
import type { ImageFormats, ImageSize } from "../types/cdn.ts";
|
||||
import { Errors } from "../types/errors.ts";
|
||||
import type {
|
||||
BannedUser,
|
||||
BanOptions,
|
||||
|
||||
ChannelCreateOptions,
|
||||
CreateEmojisOptions,
|
||||
PositionSwap,
|
||||
EditEmojisOptions,
|
||||
|
||||
CreateRoleOptions,
|
||||
|
||||
CreateServerOptions,
|
||||
EditEmojisOptions,
|
||||
|
||||
EditIntegrationOptions,
|
||||
FetchMembersOptions,
|
||||
GetAuditLogsOptions,
|
||||
EditIntegrationOptions,
|
||||
BanOptions,
|
||||
|
||||
GuildEditOptions,
|
||||
PositionSwap,
|
||||
|
||||
PruneOptions,
|
||||
PrunePayload,
|
||||
ChannelCreateOptions,
|
||||
BannedUser,
|
||||
UserPayload,
|
||||
CreateServerOptions,
|
||||
} from "../types/guild.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";
|
||||
UserPayload,
|
||||
} from "../types/guild.ts";
|
||||
import type { MemberCreatePayload } from "../types/member.ts";
|
||||
import { Intents } from "../types/options.ts";
|
||||
import { identifyPayload } from "../module/client.ts";
|
||||
import { requestAllMembers } from "../module/shardingManager.ts";
|
||||
import { botHasPermission, calculateBits } 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 type { RoleData } from "../types/role.ts";
|
||||
import { formatImageURL } from "../utils/cdn.ts";
|
||||
import { Collection } from "../utils/collection.ts";
|
||||
import { botHasPermission, calculateBits } from "../utils/permissions.ts";
|
||||
import { urlToBase64 } from "../utils/utils.ts";
|
||||
|
||||
/** Create a new guild. Returns a guild object on success. Fires a Guild Create Gateway event. This endpoint can be used only by bots in less than 10 guilds. */
|
||||
export function createServer(options: CreateServerOptions) {
|
||||
|
||||
@@ -1,25 +1,24 @@
|
||||
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 { 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 type { Member } from "../structures/member.ts";
|
||||
import { structures } from "../structures/mod.ts";
|
||||
import type { ImageFormats, ImageSize } from "../types/cdn.ts";
|
||||
import type {
|
||||
DMChannelCreatePayload,
|
||||
MessageContent,
|
||||
} from "../types/channel.ts";
|
||||
import { Errors } from "../types/errors.ts";
|
||||
import type { EditMemberOptions } from "../types/member.ts";
|
||||
import { Permissions } from "../types/permission.ts";
|
||||
import { formatImageURL } from "../utils/cdn.ts";
|
||||
import {
|
||||
highestRole,
|
||||
higherRolePosition,
|
||||
botHasPermission,
|
||||
higherRolePosition,
|
||||
highestRole,
|
||||
} from "../utils/permissions.ts";
|
||||
import { sendMessage } from "./channel.ts";
|
||||
|
||||
/** The users custom avatar or the default avatar if you don't have a member object. */
|
||||
export function rawAvatarURL(
|
||||
|
||||
@@ -1,16 +1,15 @@
|
||||
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 "../../deps.ts";
|
||||
import { structures } from "../structures/mod.ts";
|
||||
import { endpoints } from "../constants/discord.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 type { Message } from "../structures/message.ts";
|
||||
import { structures } from "../structures/mod.ts";
|
||||
import type { MessageContent } from "../types/channel.ts";
|
||||
import { Errors } from "../types/errors.ts";
|
||||
import type { UserPayload } from "../types/guild.ts";
|
||||
import type { MessageCreateOptions } from "../types/message.ts";
|
||||
import { Permissions } from "../types/permission.ts";
|
||||
import { botHasChannelPermissions } from "../utils/permissions.ts";
|
||||
|
||||
/** Delete a message with the channel id and message id only. */
|
||||
|
||||
@@ -1,17 +1,16 @@
|
||||
import { endpoints } from "../constants/discord.ts";
|
||||
import { RequestManager } from "../module/requestManager.ts";
|
||||
import { structures } from "../structures/mod.ts";
|
||||
import { Errors } from "../types/errors.ts";
|
||||
import type { MessageCreateOptions } from "../types/message.ts";
|
||||
import { Permissions } from "../types/permission.ts";
|
||||
import type {
|
||||
ExecuteWebhookOptions,
|
||||
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 { urlToBase64 } from "../utils/utils.ts";
|
||||
import { structures } from "../structures/mod.ts";
|
||||
|
||||
/** Create a new webhook. Requires the MANAGE_WEBHOOKS permission. Returns a webhook object on success. Webhook names follow our naming restrictions that can be found in our Usernames and Nicknames documentation, with the following additional stipulations:
|
||||
*
|
||||
|
||||
@@ -1,24 +1,27 @@
|
||||
import type { DiscordBotGatewayData, ReadyPayload } from "../types/discord.ts";
|
||||
import type { IdentifyPayload } from "./client.ts";
|
||||
import {
|
||||
connectWebSocket,
|
||||
delay,
|
||||
inflate,
|
||||
isWebSocketCloseEvent,
|
||||
isWebSocketPingEvent,
|
||||
isWebSocketPongEvent,
|
||||
WebSocket,
|
||||
} from "../../deps.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 type {
|
||||
DiscordBotGatewayData,
|
||||
DiscordHeartbeatPayload,
|
||||
ReadyPayload,
|
||||
} from "../types/discord.ts";
|
||||
import { GatewayOpcode } from "../types/discord.ts";
|
||||
import {
|
||||
eventHandlers,
|
||||
botGatewayData,
|
||||
} from "./client.ts";
|
||||
import { delay } from "../../deps.ts";
|
||||
import { inflate } from "../../deps.ts";
|
||||
import type { FetchMembersOptions } from "../types/guild.ts";
|
||||
import { Collection } from "../utils/collection.ts";
|
||||
import type { BotStatusRequest } from "../utils/utils.ts";
|
||||
import type { IdentifyPayload } from "./client.ts";
|
||||
import {
|
||||
botGatewayData,
|
||||
eventHandlers,
|
||||
} from "./client.ts";
|
||||
import { handleDiscordPayload } from "./shardingManager.ts";
|
||||
|
||||
export const basicShards = new Collection<number, BasicShard>();
|
||||
const heartbeating = new Set<number>();
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
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 type { DiscordBotGatewayData } from "../types/discord.ts";
|
||||
import type { ClientOptions, EventHandlers } from "../types/options.ts";
|
||||
import { RequestManager } from "./requestManager.ts";
|
||||
import { spawnShards } from "./shardingManager.ts";
|
||||
|
||||
export let authorization = "";
|
||||
export let botID = "";
|
||||
|
||||
@@ -1,10 +1,9 @@
|
||||
import { HttpResponseCode } from "../types/discord.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 { delay } from "../../deps.ts";
|
||||
import { baseEndpoints } from "../constants/discord.ts";
|
||||
import { HttpResponseCode } from "../types/discord.ts";
|
||||
import { Errors } from "../types/errors.ts";
|
||||
import type { RequestMethods } from "../types/fetch.ts";
|
||||
import { authorization, eventHandlers } from "./client.ts";
|
||||
|
||||
const pathQueues: { [key: string]: QueuedRequest[] } = {};
|
||||
const ratelimitedPaths = new Map<string, RateLimitedPath>();
|
||||
|
||||
@@ -1,19 +1,14 @@
|
||||
import type { WebSocket } from "../../deps.ts";
|
||||
import { connectWebSocket, delay, isWebSocketCloseEvent } from "../../deps.ts";
|
||||
import type {
|
||||
DiscordBotGatewayData,
|
||||
DiscordHeartbeatPayload,
|
||||
ReadyPayload,
|
||||
} from "../types/discord.ts";
|
||||
import { GatewayOpcode } 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 { delay } from "../../deps.ts";
|
||||
import {
|
||||
connectWebSocket,
|
||||
isWebSocketCloseEvent,
|
||||
} from "../../deps.ts";
|
||||
|
||||
let shardSocket: WebSocket;
|
||||
|
||||
/** The session id is needed for RESUME functionality when discord disconnects randomly. */
|
||||
|
||||
@@ -1,26 +1,26 @@
|
||||
import type { IdentifyPayload } from "./client.ts";
|
||||
import { delay } from "../../deps.ts";
|
||||
import { controllers } from "../controllers/mod.ts";
|
||||
import type { Guild } from "../structures/guild.ts";
|
||||
import type { FetchMembersOptions } from "../types/guild.ts";
|
||||
import type {
|
||||
DiscordBotGatewayData,
|
||||
DiscordPayload,
|
||||
} from "../types/discord.ts";
|
||||
import type { BotStatusRequest } from "../utils/utils.ts";
|
||||
|
||||
import { controllers } from "../controllers/mod.ts";
|
||||
import { GatewayOpcode } from "../types/discord.ts";
|
||||
import type { FetchMembersOptions } from "../types/guild.ts";
|
||||
import { cache } from "../utils/cache.ts";
|
||||
import type { BotStatusRequest } from "../utils/utils.ts";
|
||||
import {
|
||||
botGatewayStatusRequest,
|
||||
createBasicShard,
|
||||
requestGuildMembers,
|
||||
botGatewayStatusRequest,
|
||||
} from "./basicShard.ts";
|
||||
import type { IdentifyPayload } from "./client.ts";
|
||||
import {
|
||||
eventHandlers,
|
||||
botGatewayData,
|
||||
eventHandlers,
|
||||
|
||||
identifyPayload,
|
||||
} from "./client.ts";
|
||||
import { GatewayOpcode } from "../types/discord.ts";
|
||||
import { delay } from "../../deps.ts";
|
||||
|
||||
let shardCounter = 0;
|
||||
let basicSharding = false;
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import { cacheHandlers } from "../controllers/cache.ts";
|
||||
import type { ChannelCreatePayload } from "../types/channel.ts";
|
||||
import type { Unpromise } from "../types/misc.ts";
|
||||
|
||||
import { cacheHandlers } from "../controllers/cache.ts";
|
||||
import { calculatePermissions } from "../utils/permissions.ts";
|
||||
|
||||
export async function createChannel(
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
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 { Collection } from "../utils/collection.ts";
|
||||
import type { Member } from "./member.ts";
|
||||
import { structures } from "./mod.ts";
|
||||
|
||||
export async function createGuild(data: CreateGuildPayload, shardID: number) {
|
||||
const {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { RawOverwrite, Overwrite } from "./guild.ts";
|
||||
import type { Overwrite, RawOverwrite } from "./guild.ts";
|
||||
import type { Embed } from "./message.ts";
|
||||
|
||||
export interface ChannelEditOptions {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
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";
|
||||
import type { Activity } from "./message.ts";
|
||||
import type { ClientStatusPayload } from "./presence.ts";
|
||||
|
||||
export interface DiscordPayload {
|
||||
/** OP code for the payload */
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
import type { 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 { Permission } from "./permission.ts";
|
||||
import type { ClientStatusPayload } from "./presence.ts";
|
||||
import type { ChannelCreatePayload, ChannelTypes } from "./channel.ts";
|
||||
import type { RoleData } from "./role.ts";
|
||||
|
||||
export interface GuildRolePayload {
|
||||
/** The id of the guild */
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
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";
|
||||
import type { UserPayload } from "./guild.ts";
|
||||
import type { MemberCreatePayload } from "./member.ts";
|
||||
|
||||
export interface MentionedUser extends UserPayload {
|
||||
member: MemberCreatePayload;
|
||||
|
||||
@@ -1,26 +1,30 @@
|
||||
import type {
|
||||
Properties,
|
||||
Emoji,
|
||||
DiscordPayload,
|
||||
PresenceUpdatePayload,
|
||||
TypingStartPayload,
|
||||
VoiceStateUpdatePayload,
|
||||
} from "./discord.ts";
|
||||
import type { Role } from "../structures/role.ts";
|
||||
import type { Message } from "../structures/message.ts";
|
||||
import type {
|
||||
PartialMessage,
|
||||
ReactionPayload,
|
||||
BaseMessageReactionPayload,
|
||||
MessageReactionRemoveEmojiPayload,
|
||||
Embed,
|
||||
Attachment,
|
||||
MessageReactionUncachedPayload,
|
||||
} from "./message.ts";
|
||||
import type { Channel } from "../structures/channel.ts";
|
||||
import type { Guild } from "../structures/guild.ts";
|
||||
import type { Member } from "../structures/member.ts";
|
||||
import type { Message } from "../structures/message.ts";
|
||||
import type { Role } from "../structures/role.ts";
|
||||
import type {
|
||||
DiscordPayload,
|
||||
Emoji,
|
||||
|
||||
PresenceUpdatePayload,
|
||||
Properties,
|
||||
|
||||
TypingStartPayload,
|
||||
VoiceStateUpdatePayload,
|
||||
} from "./discord.ts";
|
||||
import type { UserPayload } from "./guild.ts";
|
||||
import type {
|
||||
Attachment,
|
||||
BaseMessageReactionPayload,
|
||||
|
||||
Embed,
|
||||
MessageReactionRemoveEmojiPayload,
|
||||
|
||||
MessageReactionUncachedPayload,
|
||||
PartialMessage,
|
||||
ReactionPayload,
|
||||
} from "./message.ts";
|
||||
|
||||
export interface Fulfilled_Client_Options {
|
||||
token: string;
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import { Collection } from "./collection.ts";
|
||||
import type { Message } from "../structures/message.ts";
|
||||
import type { Guild } from "../structures/guild.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 { Collection } from "./collection.ts";
|
||||
|
||||
export interface CacheData {
|
||||
isReady: boolean;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { ImageSize, ImageFormats } from "../types/cdn.ts";
|
||||
import type { ImageFormats, ImageSize } from "../types/cdn.ts";
|
||||
|
||||
export const formatImageURL = (
|
||||
url: string,
|
||||
|
||||
@@ -1,10 +1,9 @@
|
||||
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 { cacheHandlers } from "../controllers/cache.ts";
|
||||
import { botID } from "../module/client.ts";
|
||||
import type { Guild } from "../structures/guild.ts";
|
||||
import type { Role } from "../structures/role.ts";
|
||||
import type { Permission } from "../types/permission.ts";
|
||||
import { Permissions } from "../types/permission.ts";
|
||||
|
||||
/** Checks if the member has this permission. If the member is an owner or has admin perms it will always be true. */
|
||||
export async function memberIDHasPermission(
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
import type { StatusType } from "../types/discord.ts";
|
||||
|
||||
import { ActivityType } from "../types/activity.ts";
|
||||
import { sendGatewayCommand } from "../module/shardingManager.ts";
|
||||
import { encode } from "../../deps.ts";
|
||||
import { sendGatewayCommand } from "../module/shardingManager.ts";
|
||||
import { ActivityType } from "../types/activity.ts";
|
||||
import type { StatusType } from "../types/discord.ts";
|
||||
|
||||
export const sleep = (timeout: number) => {
|
||||
return new Promise((resolve) => setTimeout(resolve, timeout));
|
||||
|
||||
Reference in New Issue
Block a user