v9.0.1
版本发布时间: 2020-09-27 09:08:02
discordeno/discordeno最新发布版本:18.0.0(2023-01-13 07:50:21)
Version 9 is all about flexibility and customizability. It allows you to dig in and make Discordeno work exactly how you want it to. Had to do 9.0.1 because I had a silly mistake in forgetting to publish deps.ts to nest.land for the 9.0.0.
- Supports latest Deno and TS changes.
- API Version switched to v8 instead of v6/v7. v8 is the latest change to the Discord API.
- Breaking changes made in v8 had to be adjusted in Discordeno as well.
- Custom Structures
- Custom Caching Closes #19
- Controllers
- Refactor more variables like createRole function into a function instead of a variable holding a function
- Removed the
cleanMessageCache
interval internally to allow you a much better way to handle these. The new advanced caching features allow a much more granular control and therefore this function was no longer possible. To replace this, I have added asweeper
task to the boilerplate so if you are using that, you can copy that file to your bot. This task will help clean out your cache for the most part so that your bot is optimized as much as possible - Some functions like highestRole need to be async to support the custom caching features which require await.
-
_new
permission fields have been removed. - The following properties have been removed from presence.
roles
,nick
,premium_since
- Removed
hasChannelPermission
forchannelOverwriteHasPermission
. - Refactored a bunch of handler functions. For example
sendMessage
needed a Channel before. Now it only needs a channelID. The change was made to allow bots to be more stateless so that they can grow much larger without needing to rely on everything existing in cache. - Removed some leftover snake_case options in editChannel options. For example:
rate_limit_per_user
is nowslowmode
- Member.tag and Member.mention have been removed to help preserve memory. These are extra additions not provided by the raw API. This takes away from the library's minimalistic goal. The new custom structures however allow you to add them back easily. In fact, that is exactly what we have done in the boilerplate. You will still retain options for these in the boilerplate. Simply, take the structures folder and place it in your bot folder.
- Zlib Compression is now added.
- Renamed leave() to leaveGuild() to remove ambiguity.
- Removed logger
- Stack Trace Errors shows errors where your bot's code errored. Never again suffer errors that you can't fix
Previous Errors:
error: Uncaught Error: REQUEST_CLIENT_ERROR
throw new Error(Errors.REQUEST_CLIENT_ERROR);
^
at handleStatusCode (requestManager.ts:314:13)
at Object.callback (requestManager.ts:233:9)
at async requestManager.ts:101:28
New Errors:
{
type: "error",
data: {
method: "patch",
url: "https://discord.com/api/v8/guilds/223909216866402304/members/130136895395987456",
body: { nick: "test" },
retryCount: 0,
bucketID: undefined,
errorStack: Error: Location In Your Files:
at runMethod (requestManager.ts:201:9)
at Object.patch (requestManager.ts:133:12)
at editMember (member.ts:185:25)
at Object.messageCreate (debug.ts:36:9)
at Object.handleInternalMessageCreate [as MESSAGE_CREATE] (messages.ts:50:32)
}
}
This guide is for everything below: https://discordeno.mod.land/advanced/customizations
Note this is meant for advanced developers. Do not use this if you are not advanced enough. Powerful but dangerous. With great power comes great bugs!
Controllers
Controllers are one of the most powerful features of Discordeno. They allow you to take control of how Discordeno handles the Discord payloads from the gateway. When an event comes in, you can override and control how you want it to work. For example, if your bot does not use emojis at all, you could simply just take control over the GUILD_EMOJIS_UPDATE event and prevent anyone from caching any emojis at all. Another example, is if you are building a custom module/framework around Discordeno and you want to provide more custom events such as when someone boosts the server or some other custom event this is possible as well.
Structures
Discordeno provides the ability to customize structures. You have the ability to override the function that creates the structures inside Discordeno. THIS DOES NOT MODIFY THE PROTOTYPE! I wanted to make sure that Discordeno handled this without encouraging bad practices such as prototype pollution which can make your bots inherintly unstable and unpredictable. Discordeno allows you to take control over the functions that create the structures. In fact, if u really wanted to get fancy you could even return entire classes inside that function and the member could become a class if u want.
Custom Cacher
One of the features that Discordeno has is the ability to customize the cache. In order to do this, we will simply override the cache handlers. For example, you could use Redis caching if you like. Using this, you will be able to control where your cache is stored, how its handled and much more.