neocord
TypeScript icon, indicating that this package has built-in type declarations

0.0.0-alpha.7 • Public • Published

NeoCord is currently in alpha, meaning it will probably be broken and might not work. If you want to contribute, please join our support server - It would be greatly appreciated.

Table of Contents

About

Neocord is a powerful and feature-rich discord library.

  • Flexible: Gives you the ability to extend specific structures, customize caching to your needs.
  • Coverage: Covers the Discord Gateway, API, CDN, and in the near future, Voice.
  • Caching: Boasts the most powerful and flexible caching solution across most discord libraries.

Installation

As of 09/04/2020 (month/day/year), NeoCord can only be used with node.js v12 and up.

yarn add neocord
Optional Packages

These are some optional packages you can install.

  • Install zlib-sync or pako for data compression and inflation

  • erlpack for significantly faster websocket (de)serialization.

  • bufferutil for a much faster websocket connection.

    And utf-8-validate for faster websocket processing.

Basic Usage

(typescript)

import { Client } from "neocord";
 
const client = new Client();
 
client
  .on("ready", () => console.log("Now ready!"))
  .on("messageCreate", (message) => {
    if (message.author.bot) return;
 
    const mentionPrefix = new RegExp(`^<@!${client.user.id}>\s*`);
 
    let prefix;
    if (message.content.startsWith("!")) prefix = "!"
    else {
      const mentioned = mentionPrefix.exec(message.content);
      if (!mentioned) return;
      prefix = mentioned[0]; 
    }
    
    const [cmd] = message.content.slice(prefix.length).split(/ /g);
    if (cmd.toLowerCase() === "ping") {
      message.channel.send("**Pong!**");
    }
 
    return;
  });
 
 
client.connect("your token here"); 

Links


melike2d © 2020

Package Sidebar

Install

npm i neocord

Weekly Downloads

12

Version

0.0.0-alpha.7

License

MIT

Unpacked Size

465 kB

Total Files

105

Last publish

Collaborators

  • the2dperson