This package has been deprecated

Author message:

Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.

discordeno.js
TypeScript icon, indicating that this package has built-in type declarations

0.1.4 • Public • Published

Discord server

Discordeno.js

Discordeno.js is a wrapper around a very scalable library named Discordeno, which brings up a djs-like interface but also includes the core Features (Cross Ratelimit, Zero Downtime Restart, Resharding...).

Why should I change?

Djs was always meant for beginners. They way how it is built, it's not very scalable. Moreover it is bloated up with a lot of nested classes and references.

It is very noticeable that there are many breaking changes by djs. Each version has changes, most of which are very unnecessary.

Also, it's a fact that updates take a long time, you can't use new features, which happens more and more since Discord keeps introducing new features.

As example the v13 Modal PR isn't merged yet and its already 1 month, where as discordeno.js had it on the beginning date of the launch.

A migration would require breaking changes too?

We built the interface so that it can be used to switch between different libraries with very minor changes on Discordeno's side. This allows us to introduce support for other libraries, such as the Raw API.

Of course, a migration would include breaking changes, as we decided to improve the coding experience by simplifying it while incorporating high coding standards.

As of now, the biggest change is that ids use BigInts instead of the usual strings. This is because they use less memory. Therefore, depending on the database, you would have to stringfying the id before saving the document The snowflake transformer has been overwritten to use strings instead of BigInts.

Common changes are listed in the gist, which is updated on the fly.

The wrapper supports commonly used functions such as .send, .pin, .create... . There might be a lack of other functions, but this can be easily added via a PR with a very less coding knowledge.

Features:

  • Custom Property Caching
  • Raw Cache Storage
  • Structures of common Resources (Guilds, Channels, Users, Roles, Emojis, etc.)
  • Builders for common Resources (Embeds, Components)
  • Collectors

Guide:

Documentation:

The package is on a very early stage, currently its a lacking a documentation.

Whitepaper:

Discord.Client

const Discord = require('discordeno.js');
const baseBot = Discord.createBot({
  events: {
      ready: () => {
          console.log('Ready!');
      },
      messageCreate(bot, message){
            console.log(message.content);
      }
  },
  intents: ["Guilds", "GuildMessages"],
  token: config.token,
});

const client = Discord.enableCachePlugin(baseBot, {
    guilds: {
        properties: ['id', 'members', 'name', 'roles', 'channels', 'emojis'],
    },
    roles: {
        properties: ['id', 'name', 'permissions'],
    },
    channels: {
        properties: ['id', 'name', 'type', 'messages'],
    },
    users: {
        properties: ['id', 'username', 'discriminator'],
        maxSize: 100,
    },
    members: {
        properties: ['id', 'roles', 'nickname'],
        forceSetFilter: (key, value) => {
                if (key === `${client.id}`) return true; // Sub Collection on Guild Level, pass when client user is the member
                if (key === `${client.id}${value?.guildId}`) return true; // Main Collection, pass when client user is the member of the guild
                return false;
        }
    },
    emojis: {
        properties: ['id', 'name'],
    },
    threads: {
        properties: ['id', 'channelId', 'type'],
    },
    messages: {
        properties: ['id', 'channelId', 'type'],
        // transformerClass: Discord.Message
    },
    stageInstances: {
        properties: ['id', 'guildId', 'type'],
        // transformerClass: Discord.StageInstance
    },
});
Discord.startBot(client);

Convert Discordeno Objects to Structures

Guild:

const guild = client.guilds.forge(ddGuild);

Emoji:

const emoji = client.emojis.forge(ddEmoji);

Role:

const role = client.roles.forge(ddRole);

Member:

const member = client.members.forge(ddMember);

User:

const user = client.users.forge(ddUser);

Channel:

const channel = client.channels.forge(ddChannel);

Message:

const message = client.messages.forge(ddMessage);

Get raw data of a structure:

const guild = client.guilds.cache.get(guildId);
const rawData = guild._raw;

const rawData2 = client.guilds.cache._get(guildId);
// Same accounts for other structures

Open Collector:

 // this.client.eventListener must exist, which is a eventEmitter created manually and fires when a event has been fired
 const filter = (m) => m.data?.customId === "warn_modal";
 const collector = new Collector("interactionCreate", { client: this.client, timeout: 60000, filter });

Builders:

Embed:

Component:

Bugs, glitches and issues

If you encounter any problems feel free to open an issue in our GitHub repository or join the Discord server.

Credits

All Credits goes to the discordeno library.

Package Sidebar

Install

npm i discordeno.js

Weekly Downloads

22

Version

0.1.4

License

MIT

Unpacked Size

157 kB

Total Files

48

Last publish

Collaborators

  • meister03