mirror of
https://github.com/discordeno/discordeno.git
synced 2026-06-03 17:30:07 +00:00
Merge remote-tracking branch 'upstream/master'
This commit is contained in:
@@ -4,7 +4,15 @@
|
||||
|
||||
// Set *default* container specific settings.json values on container create.
|
||||
"settings": {
|
||||
"terminal.integrated.shell.linux": "/bin/bash"
|
||||
"terminal.integrated.shell.linux": "/bin/bash",
|
||||
"deno.enable": true,
|
||||
"deno.lint": true,
|
||||
"editor.defaultFormatter": "denoland.vscode-deno",
|
||||
"editor.formatOnSave": true,
|
||||
"editor.codeActionsOnSave": {
|
||||
"source.organizeImports": true,
|
||||
"source.fixAll": true
|
||||
}
|
||||
},
|
||||
|
||||
// Add the IDs of extensions you want installed when the container is created.
|
||||
@@ -20,4 +28,4 @@
|
||||
|
||||
// Uncomment to connect as a non-root user. See https://aka.ms/vscode-remote/containers/non-root.
|
||||
// "remoteUser": "vscode"
|
||||
}
|
||||
}
|
||||
|
||||
6
.github/workflows/test.yml
vendored
6
.github/workflows/test.yml
vendored
@@ -13,10 +13,8 @@ jobs:
|
||||
deno-version: ${{ matrix.deno }}
|
||||
- name: Cache dependencies
|
||||
run: deno cache mod.ts
|
||||
- name: Run local tests
|
||||
run: TEST_TYPE=local deno test --allow-env
|
||||
- name: Run API tests
|
||||
- name: Run test script
|
||||
if: github.ref == 'refs/heads/master'
|
||||
run: TEST_TYPE=api deno test --allow-net --allow-env
|
||||
run: deno test --allow-net --allow-env
|
||||
env:
|
||||
DISCORD_TOKEN: ${{ secrets.DISCORD_TOKEN }}
|
||||
|
||||
8
.gitignore
vendored
8
.gitignore
vendored
@@ -19,4 +19,10 @@ public/
|
||||
.idea/
|
||||
|
||||
# Windows
|
||||
desktop.ini
|
||||
desktop.ini
|
||||
|
||||
# Visual Studio Code
|
||||
.vscode/*
|
||||
!.vscode/tasks.json
|
||||
!.vscode/launch.json
|
||||
*.code-workspace
|
||||
|
||||
1
.vscode/settings.json
vendored
1
.vscode/settings.json
vendored
@@ -1,7 +1,6 @@
|
||||
{
|
||||
"deno.enable": true,
|
||||
"deno.lint": true,
|
||||
"deno.unstable": true,
|
||||
"editor.defaultFormatter": "denoland.vscode-deno",
|
||||
"editor.formatOnSave": true,
|
||||
"editor.codeActionsOnSave": {
|
||||
|
||||
18
README.md
18
README.md
@@ -10,12 +10,22 @@ Discordeno follows [Semantic Versioning](https://semver.org/)
|
||||

|
||||

|
||||
|
||||
## Table of contents
|
||||
|
||||
- [Features](#features)
|
||||
- [Getting Started](#getting-started)
|
||||
- [Minimal Example](#minimal-example)
|
||||
- [Boilerplates](#boilerplates)
|
||||
- [Links](#links)
|
||||
- [Contributing](#contributing)
|
||||
|
||||
## Features
|
||||
|
||||
- **Secure & stable**: Discordeno is actively maintained to ensure great
|
||||
performance and convenience. Moreover, it internally checks all missing
|
||||
permissions before forwarding a request to the Discord API so that the client
|
||||
does not get globally-banned by Discord.
|
||||
does not get
|
||||
[globally-banned by Discord](https://discord.com/developers/docs/topics/rate-limits#invalid-request-limit).
|
||||
- **Simple, Efficient, & Lightweight**: Discordeno is simplistic, easy-to-use,
|
||||
versatile while being efficient and lightweight. Follows
|
||||
[Convention Over Configuration](https://en.wikipedia.org/wiki/Convention_over_configuration)
|
||||
@@ -64,7 +74,7 @@ unofficial boilerplates:
|
||||
(official)](https://github.com/discordeno/slash-commands-boilerplate)
|
||||
- [Add Your Own!](https://github.com/discordeno/discordeno/pulls)
|
||||
|
||||
## Useful Links
|
||||
## Links
|
||||
|
||||
- [Website](https://discordeno.mod.land)
|
||||
- [Documentation](https://doc.deno.land/https/deno.land/x/discordeno/mod.ts)
|
||||
@@ -74,7 +84,3 @@ unofficial boilerplates:
|
||||
|
||||
We appreciate your help! Before contributing, please read the
|
||||
[Contributing Guide](https://github.com/discordeno/discordeno/blob/master/.github/CONTRIBUTING.md).
|
||||
|
||||
### License
|
||||
|
||||
[License can be found here](https://github.com/discordeno/discordeno/blob/master/LICENSE)
|
||||
|
||||
@@ -54,5 +54,5 @@ resources:
|
||||
- [TypeScript Crash Course by Traversy
|
||||
Media](https://www.youtube.com/watch?v=rAy_3SIqT-E)
|
||||
|
||||
There is always more resources... Take your time and don't fret! Come back when
|
||||
There are always more resources... Take your time and don't fret! Come back when
|
||||
you are ready, we can't wait to see what your Discordeno created bot does!
|
||||
|
||||
@@ -21,13 +21,14 @@ of it's code! A breaking change in typings is a breaking change for the library!
|
||||
|
||||
## How Stable Is Discordeno?
|
||||
|
||||
One of the biggest issues with almost every library(I have used) is stability.
|
||||
None of the libraries gave much love and attention to TypeScript developers the
|
||||
way it deserves. Sometimes TypeScript projects would break because breaking
|
||||
changes to typings did not make a MAJOR bump so TypeScript bots in production
|
||||
would break. Sometimes I was personally maintaing the typings because no one
|
||||
else was for that lib. Some libs were pre 1.0 and didn't even have a stable
|
||||
branch/version where I would not have to worry about breaking changes.
|
||||
One of the biggest issues with almost every library (that I have used) is
|
||||
stability. None of the libraries gave much love and attention to TypeScript
|
||||
developers the way it deserves. Sometimes TypeScript projects would break
|
||||
because breaking changes to typings did not make a MAJOR bump so TypeScript bots
|
||||
in production would break. Sometimes I was personally maintaining the typings
|
||||
because no one else was for that lib. Some libs were pre 1.0 and didn't even
|
||||
have a stable branch/version where I would not have to worry about breaking
|
||||
changes.
|
||||
|
||||
This is why I made it one of my foundational goals of this library to have the
|
||||
best stability for TypeScript developers. No matter how small, a breaking change
|
||||
|
||||
@@ -146,7 +146,7 @@ export async function createGuild(data: CreateGuildPayload, shardID: number) {
|
||||
);
|
||||
|
||||
await Promise.all(channels.map(async (channel) => {
|
||||
const channelStruct = await structures.createChannel(channel);
|
||||
const channelStruct = await structures.createChannel(channel, rest.id);
|
||||
return cacheHandlers.set("channels", channelStruct.id, channelStruct);
|
||||
}));
|
||||
|
||||
|
||||
@@ -52,15 +52,15 @@ export async function botHasPermission(
|
||||
guildID: string,
|
||||
permissions: Permission[],
|
||||
) {
|
||||
const member = await cacheHandlers.get("members", botID);
|
||||
if (!member) return false;
|
||||
|
||||
const guild = await cacheHandlers.get("guilds", guildID);
|
||||
if (!guild) return false;
|
||||
|
||||
// Check if the bot is the owner of the guild, if it is, returns true
|
||||
if (guild.ownerID === botID) return true;
|
||||
|
||||
const member = await cacheHandlers.get("members", botID);
|
||||
if (!member) return false;
|
||||
|
||||
// The everyone role is not in member.roles
|
||||
const permissionBits = [...member.guilds.get(guildID)?.roles || [], guild.id]
|
||||
.map((id) => guild.roles.get(id)!)
|
||||
|
||||
@@ -13,6 +13,7 @@ import {
|
||||
cache,
|
||||
Channel,
|
||||
channelOverwriteHasPermission,
|
||||
closeWS,
|
||||
createGuildChannel,
|
||||
createGuildRole,
|
||||
createServer,
|
||||
@@ -36,7 +37,6 @@ import {
|
||||
export const defaultTestOptions: Partial<Deno.TestDefinition> = {
|
||||
sanitizeOps: false,
|
||||
sanitizeResources: false,
|
||||
ignore: Deno.env.get("TEST_TYPE") !== "api",
|
||||
};
|
||||
|
||||
// Temporary data
|
||||
@@ -59,14 +59,6 @@ Deno.test({
|
||||
intents: ["GUILD_MESSAGES", "GUILDS"],
|
||||
});
|
||||
|
||||
eventHandlers.ready = () => {
|
||||
if (cache.guilds.size >= 10) {
|
||||
cache.guilds.map((guild) =>
|
||||
guild.ownerID === botID && deleteServer(guild.id)
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
// Delay the execution by 5 seconds
|
||||
await delay(5000);
|
||||
|
||||
@@ -348,8 +340,9 @@ Deno.test({
|
||||
|
||||
// Forcefully exit the Deno process once all tests are done.
|
||||
Deno.test({
|
||||
name: "exit the process forcefully after all the tests are done\n",
|
||||
name: "[main] close the websocket connection",
|
||||
fn() {
|
||||
Deno.exit();
|
||||
closeWS();
|
||||
},
|
||||
...defaultTestOptions,
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user