MyGit

10.0.0

discordeno/discordeno

版本发布时间: 2020-12-31 23:59:48

discordeno/discordeno最新发布版本:18.0.0(2023-01-13 07:50:21)

From breaking changes to small bug fixes to QoL improvements, this release has it all. This is Discordeno Next!

Slash Commands and Interactions

A Slash Command is a command that you register for your application. It consists of a name, description, and a block of options, which you can think of like arguments to a function.

An Interaction is the message that your application receives when a user uses a command.

Discordeno, from v10 or newer, has inbuilt support for both slash commands and interactions. For a quick start, check out our official boilerplate for slash commands.

slash commands

Getters for Structures

Getters are introduced in Discordeno v10 as a QoL improvement.

import { sendMessage } from "discordeno";

await sendMessage("Channel ID", "Content");
...
message.send("Content");

Permission enums to Permission strings

This change is a breaking change, it increases consistency by enabling users to use consistent API throughout their code.

import { hasChannelPermissions, Permissions } from "discordeno";

await hasChannelPermissions(
    "Channel ID",
    "User ID",
    [Permissions.MANAGE_MESSAGES]
);
import { hasChannelPermissions } from "discordeno";

await hasChannelPermissions("Channel ID", "User ID", ["MANAGE_MESSAGES"]);

Guild.channels and Guild.members as Getters

These changes were made to optimize memory. To properly explain these changes, let's take an example of a user in X number of guilds, previously, in v9 or before, the member object was cached X times. However, with the release of v10, it stores the member object only once, hence saving memory.

Similarly, Guild.channels is converted into a getter in v10 or newer. This is removed because it was storing duplicated values from cache.channels, and hence taking additional memory.

Improved WebSocket Close Errors

import { createClient } from "discordeno";

createClient({
    token: "BOT TOKEN",
    // Invalid intents
    intents: [1234567890]
});

// throws: "Shard.ts: Error occurred that is not resumeable or able to be reconnected."
import { startBot } from "discordeno";

startBot({
    token: "BOT TOKEN",
    intents: [1234567890]
});

// throws: "[Invalid intent(s)] Sent an invalid intent for a Gateway Intent."

Proxy WebSocket and REST URL

import { startBigBrainBot } from "discordeno";

startBigBrainBot({
    wsURL: "wss://my-custom-ws-url.com",
    restURL: "https://my-custom-rest-url.com",
    cdnURL: "https://my-custom-cdn-url.com",
});

If you are already using Discordeno, you can update to v10 by updating the import URL for Discordeno to the following, usually present in deps.ts file.

https://deno.land/x/discordeno@10.0.0/mod.ts

相关地址:原始地址 下载(tar) 下载(zip)

查看:2020-12-31发行的版本