discordeno

Discord API library for Node and Deno

APACHE-2.0 License

Downloads
14.7K
Stars
784
Committers
89

Bot releases are visible (Hide)

discordeno - 18.0.0 - AUDIT LOG EVENT Latest Release

Published by Skillz4Killz almost 2 years ago

What's Changed

New Contributors

Full Changelog: https://github.com/discordeno/discordeno/compare/17.0.1...17.2.0

discordeno - 17.1.0

Published by Skillz4Killz almost 2 years ago

What's Changed

Full Changelog: https://github.com/discordeno/discordeno/compare/17.0.0...17.0.1

discordeno - 17.0.0

Published by Skillz4Killz about 2 years ago

What's Changed

New Contributors

Full Changelog: https://github.com/discordeno/discordeno/compare/16.0.1...17.0.0

discordeno - 16.0.1

Published by Skillz4Killz about 2 years ago

What's Changed

Full Changelog: https://github.com/discordeno/discordeno/compare/16.0.0...16.0.1

discordeno - 16.0.0

Published by Skillz4Killz about 2 years ago

This release was mainly made because we updated a dependency "undici" for node.js users. This dependency had a breaking change, so we bumped it to 16. While this was a breaking change, i also merged two pending breaking change prs that were finalized. Some functions that discord no longer supports, we removed and the name of a permission was changed since discord changed it as well.

The main thing that will break in your bots, is most like the name change of MANAGE_EMOJIS => MANAGE_EMOJIS_AND_STICKERS

What's Changed

Full Changelog: https://github.com/discordeno/discordeno/compare/15.0.4...16.0.0

discordeno - 15.0.4

Published by Skillz4Killz about 2 years ago

What's Changed

Full Changelog: https://github.com/discordeno/discordeno/compare/15.0.3...15.0.4

discordeno - 15.0.3

Published by Skillz4Killz about 2 years ago

What's Changed

Full Changelog: https://github.com/discordeno/discordeno/compare/15.0.2...15.0.3

discordeno - 15.0.2

Published by Skillz4Killz about 2 years ago

discordeno - 15.0.1

Published by Skillz4Killz about 2 years ago

discordeno - 15.0.0

Published by Skillz4Killz about 2 years ago

What's Changed

Full Changelog: https://github.com/discordeno/discordeno/compare/14.0.1...15.0.0

discordeno - 14.0.0 - First Lieutenant Mathew Scott

Published by Skillz4Killz about 2 years ago

What's Changed

Directories and files moved:

  • Stage instance helpers (/channels) -> /channels/stages
  • /channels/followChannel.ts -> /channels/announcements/followChannel.ts
  • /channels/updateVoiceState.ts -> /guilds/updateVoiceState.ts
  • /channels/getPins.ts -> /messages/getPins.ts
  • Voice helpers (/guilds) -> /guilds/voice
  • /guilds/scheduledEvents -> /guilds/events
  • Widget helpers (/guilds) -> /guilds/widget
  • /integrations -> /guilds/integrations
  • Interaction response helpers (/interactions + /interactions/commands) -> /interactions/responses
  • /invites/getChannelInvites.ts -> /channels/getChannelInvites.ts
  • /invites -> /guilds/invites
  • Reaction helpers (/messages) -> /messages/reactions
  • /oauth/getApplicationInfo.ts -> /misc/getApplicationInfo.ts
  • Voice helpers (/voice) -> /guilds/voice

Keyword changes

In all functions: modify -> edit
In all functions: update -> edit

Function + filename renamings

  • followChannel -> followAnnouncementChannel
  • createForumPost -> createForumThread
  • updateStageInstance -> editStageInstance
  • addToThread -> addThreadMember
  • deleteChannelOverwrite -> deleteChannelPermissionOverride
  • editChannelOverwrite -> editChannelPermissionOverrides
  • startTyping -> triggerTypingIndicator
  • swapChannels -> editChannelPositions
  • getPins -> getPinnedMessages
  • publishMessage -> crosspostMessage
  • modifyRolePositions -> editRolePositions
  • deleteAllReactions -> deleteReactionsAll
  • deleteReactionEmoji -> deleteReactionsEmoji
  • updateBotVoiceState -> editOwnVoiceState
  • updateUserVoiceState -> editUserVoiceState
  • editWidget -> editWidgetSettings
  • getAuditLogs -> getAuditLog
  • upsertGlobalApplicationCommand -> editGlobalApplicationCommand
  • upsertGuildApplicationCommand -> editGuildApplicationCommand
  • sendWebhookMessage -> executeWebhook

⭐ marks functions for which the old function name is available as an alias.

Decouplings

  • getArchivedThreads ->
    • getPublicArchivedThreads
    • getPrivateArchivedThreads
    • getPrivateJoinedArchivedThreads
  • Decouple the following for variants concerning 'guild' and 'global' scopes:
    • createApplicationCommand -> createGuildApplicationCommand, createGlobalApplicationCommand
    • deleteApplicationCommand ^ and so on.
    • getApplicationCommand
    • getApplicationCommands
    • upsertApplicationCommand
    • upsertApplicationCommands
  • Decouple the following for a variant concerning the original response and rename the original file from *InteractionResponse to *FollowupMessage:
    • deleteInteractionResponse -> deleteOriginalInteractionResponse, deleteFollowupMessage
    • editInteractionResponse ^ and so on.
    • getInteractionResponse
    • sendInteractionResponse
  • editWebhookMessage -> editOriginalWebhookMessage, editWebhookMessage
  • deleteReaction -> deleteOwnReaction, deleteUserReaction

Deletions

  • /interactions/followups (superceded by functions in /interactions/responses)
  • editBotNickname (deprecated in the API, practically identical to editBotProfile)

Parameter renamings

  • memberId was replaced with userId.
  • Short, ambiguous parameter names such as id were updated to be more descriptive.
  • Functions where the object parameter corresponding to the query/request parameters had a different name (e.g. data) were renamed to options.

New Contributors

Full Changelog: https://github.com/discordeno/discordeno/compare/13.0.0...14.0.0

discordeno - 13.0.0 Colonel Everett Young

Published by Skillz4Killz about 2 years ago

Pure awesomeness!

Details at: https://discord.com/channels/785384884197392384/785406107912634399/1014578421050900540

What's Changed

New Contributors

Full Changelog: https://github.com/discordeno/discordeno/compare/12.0.1...13.0.0

discordeno - v13.0.0-RC1: Major General Henry Landry

Published by Skillz4Killz almost 3 years ago

This version was a big rewrite of the library that pushed the functional programming design even further. We removed almost every form of getter and a lot of OOP stuff in the library. On top of that, we made a bunch of minor improvements and fixes as well. We are now up to date with the latest changes on the discord-api-docs repo, as well as ready to support incoming features in the next month.

Benefits

  • Performance: Devs already running this version have stated their users felt the bot's become faster without being told of any changes that could effect performance. The big impact to this was most likely our decision to push the idea of Performance > Beginner friendliness. If we had to make a decision for something that either made it easier to use or better performance, we always opted for better performance.
  • Memory Improvements: 70.5% decrease in memory in a bot using v13 already.
    image
    image
  • Flexibility: Switched from convention over configuration to configuration over convention. Previously everything was not configurable but it was defaulted to the best options possible. Now everything in the library is customizable without having to fork and modify and maintain a fork. Just plugin and override anything of your choosing.
  • Caching: By default, the library will no longer cache anything. The cache has been moved to a separate plugin that you can enable should you desire. (There may be some leftovers that we will continue to remove in future release candidates.)
  • Benchmarking: We have added memory benchmarking as part of the unit tests that will run on each commit. This benchmark will show whether a commit increased or decreased the memory footprint of the library by processing about 50K events from discord. This will enable us to make sure the library stays highly optimized for large scale bots.
discordeno - Dr. Nicolas Rush

Published by itohatweb over 3 years ago

Introducing Discordeno 11.0.0

Breaking changes:

  • All functions now take a camel case object
  • All functions now return a camel case object
  • Most functions which used to return an array now return a collection
  • Template structure has been removed
  • Ids are stored using bigints now
  • The Message interfaces name is now DiscordenoMessage
  • The Channel interfaces name is now DiscordenoChannel
  • The Role interfaces name is now DiscordenoRole
  • The Guild interfaces name is now DiscordenoGuild
  • Errors.SEND_TTS_MESSAGE > Errors.SEND_TTS_MESSAGES
  • message.author has been removed
  • chooseRandom has been removed
  • message.mentions > message.allowedMentions
  • channel.slowmode > channel.rateLimitPerUser
  • Implementation of sweepers
  • Permission check functions have been renamed
  • *ID is now *Id

New features:

Bug fixes:

  • Rest is now faster and a few rate limit handling bugs have been fixed
  • Random gateway disconnections have been fixed
  • Unavailable guilds are now handled correctly on startup
discordeno - v10

Published by Skillz4Killz almost 4 years ago

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.

  • v9 or before
import { sendMessage } from "discordeno";

await sendMessage("Channel ID", "Content");
...
  • v10 or newer
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.

  • v9 or before:
import { hasChannelPermissions, Permissions } from "discordeno";

await hasChannelPermissions(
    "Channel ID",
    "User ID",
    [Permissions.MANAGE_MESSAGES]
);
  • v10 or newer:
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

  • v9 or before:
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."
  • v10 or later:
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/[email protected]/mod.ts
discordeno - v9: Vala Mal Doran

Published by Skillz4Killz about 4 years ago

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 a sweeper 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 for channelOverwriteHasPermission.
  • 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 now slowmode
  • 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.

discordeno - v8.4.1: Bigger than I thought it’d be.

Published by Skillz4Killz about 4 years ago

ATTENTION: If you have not already please join the Discord server for the latest updates. I actively keep the Discord server updated with all relevant information. Get update alerts and much more faster on discord!

This is a summary of all the updates made in the last 10 days. Enjoy 🎉

v8.3.0 - Intergalactic Encylopedia Salesman :g4m3rhug:

Added

  • removeUserReaction - Remove another users reaction
  • getChannel - Fetches a single channel object from the api.
  • getMembersByQuery - Returns guild member objects for the specified user by their nickname/username.
  • Added permission checking for adding/managing reactions.
  • getWebhook Gets a webhook with the webhook id.
  • The webhook file was not being exported in mod.ts. It is now 🎉

Fixed:

  • Slight bug in deleteMessage that wasn' checking permissions properly when a message didn't have .guildID.
  • Fixes message.mentions on DM. They will now return a member object for each user that is mentioned.
  • Fixed a small issue with the Collection.last() returning any instead of the value of the collection.

Changed

  • getChannels now returns proper Channel objects instead of raw payload. It also caches the objects by default but you can disable it.

Guide Updates:

Discordeno has one of the coolest ways to create commands for advanced level developers. I call it Dynamic command creation. This allows you to basically create a bunch of commands that are similar instantly.

This is some advanced level super magical command creation skills. Discordeno gives you the power to dynamically create commands. What that means is you can write the code for one command but dynamically create like 50 commands using that same code.


  • Added Guide for hosting your bots with Docker.

v8.3.1

The reaction functions no longer require users to properly string emojis. The library will now handle it for you.

Previously you had to change an emoji from <:g4m3rhug:458994471712063499> to name:ID however, now we will do it for you making it even easier for you to code your bots.

User Experience is everything!!!


v8.4.1

Fixed

  • TypeScript 4.0 and Deno 1.3.2 and std 0.67.0 support

Added:

  • followChannel() Use this to follow news channels. Very useful for allowing you to have server owners/admins subscribe to your bot's support news channels.
  • publishMessage() Automatically publish a message in a news channel to all servers following that channel.

Guide:

  • New guide added on Tasks to run a function at a given interval.
  • New guide on Subcommands! The most powerful of powerful features!!! Subcommands inside subcommands inside subcommands...
discordeno - v8.0.0 - Cameron Mitchell

Published by Skillz4Killz about 4 years ago

Changed

  • Collection is no longer exported by default. Please use { Collection } to import it. Default exports were breaking documentation generator.
  • /integrations?include_applications=true added query option to get back bots in integrations query.

Added

  • Cleaner prop names to be consistent for reaction events on uncached messages

Fixed

  • Small bug that didn't return the resolve the promise on empty 204 from discord.
  • Massively improved performance of rate limiter
discordeno - v.7.4.0 - Hammond of Texas

Published by Skillz4Killz about 4 years ago

Added

  • createWebhook() create a webhook
  • executeWebhook() execute a webhook to send messages or multiple embeds.
discordeno - v7.3.0: SG-1 You Have A Go!

Published by Skillz4Killz about 4 years ago

We will be jumping a couple version in minor in order to get nest.land tested and worked. P.S. We should now be on nest.land 🎉

Fixed:

  • ChannelType bug use enum instead of strings (#87)
  • add 1 second delay to prevent stack limit error #90
  • Collection.filter will now return the <K, V> of the collection you are filtering.

Added:

  • Handle a edge case where 2 roles have the same position
  • memberIDHasPermission() when you need to check permission simply with strings of ids. Much easier to use. I think in a future breaking update we may/can remove memberHasPermission and use this new function instead.
  • addReactions() function to add multiple reactions
  • allows addReaction function to be awaited by making it into async
  • Added more checks and events for debug event to show whats happening in request manager. You can now easily monitor and watch how your requests are being sent. requestManagerFetching type on debug event.

Changed:

  • Message.guildID will now always be a string. When the message is in a dm it will be an empty "" so falsy.