A Discord api Wrapper Written in Node.js, and Soon to be in Deno

A Discord api Wrapper Written in Node.js, and Soon to be in Deno

A discord API wrapper library for nodejs, and maybe deno. (oh god please help my soul)

daubu

A discord API wrapper library for nodejs, and maybe deno. (oh god please help my soul)

I should note: DO NOT USE THIS LIBRARY it barely works, and I've taken code from other libraries. It's only on NPM for testing purposes.

Why?

Honestly, I've been working on neocord, which is an upcoming discord library. So I'm deciding to make my own, because I actually somehow got interested in making a discord lib. I'm more comfortable with node.js right now, so deno probably won't happen for awhile. But yeah, why not?

Example

Using discord's v8 API

const { Client } = require("daubu");
const bot = new Client({
  token: "your token here",
  intents: ["GUILDS", "GUILD_MESSAGES"], // you will need intents using the V8 API
})

bot.on("ready", () => console.log(`Logged in as ${bot.user.tag} (${bot.user.id})`));

bot.on("messageCreate", (msg) => {
  const prefix = "!";

  if (!msg.content.startsWith(prefix) || msg.author.bot) {
    return;
  }

  const [cmd] = msg.content.slice(prefix.length).trim().split(/ +/g);

  if (cmd === "hello") {
    return msg.channel.send(`Hey there, ${msg.author.username}!`);
  }
})

bot.connect();

Using the legacy v6 API

const { Client } = require("daubu");
const bot = new Client({
  token: "your token here",
  ws: {
    v: 6, // sets the API version to v6
  }
})

bot.on("ready", () => console.log(`Logged in as ${bot.user.tag} (${bot.user.id})`));

bot.on("messageCreate", (msg) => {
  const prefix = "!";

  if (!msg.content.startsWith(prefix) || msg.author.bot) {
    return;
  }

  const [cmd] = msg.content.slice(prefix.length).trim().split(/ +/g);

  if (cmd === "hello") {
    return msg.channel.send(`Hey there, ${msg.author.username}!`);
  }
})

bot.connect();

Credits

  • neocord This library's sharding was heavily inspired by neocord
  • discordjs The Collection class idea
  • eris Compression for the shard. I don't understand a thing about zlib.

If you are a maintainer of either of these orgs, and you have a problem please DM me on discord (aesthetical#2545) or make an issue on the repo.

Download Details:

Author: Sxmurai

Source Code: https://github.com/Sxmurai/daubu

deno nodejs node javascript

Bootstrap 5 Complete Course with Examples

Bootstrap 5 Tutorial - Bootstrap 5 Crash Course for Beginners

Nest.JS Tutorial for Beginners

Hello Vue 3: A First Look at Vue 3 and the Composition API

Building a simple Applications with Vue 3

Deno Crash Course: Explore Deno and Create a full REST API with Deno

How to Build a Real-time Chat App with Deno and WebSockets

Convert HTML to Markdown Online

HTML entity encoder decoder Online

AEM Querybuilder for JavaScript (Browser, Node, Deno)

Helix Querybuilder .AEM Querybuilder for JavaScript (Browser, Node, Deno)

NKeys for JavaScript - Node.js, Browsers, and Deno

A public-key signature system based on Ed25519 for the NATS ecosystem system for JavaScript. The nkeys.js library works in Deno, Node.js, and the browser!

Javascript module for easily generating mazes,compatible with both Deno and Node

A work-in-progress Javascript maze generator module, compatible with both Deno and Node.

Deno Tutorial for Beginners: Deno vs. Node: Better Than NodeJS?

Deno is released, it’s time to find out if it can prove a worthy competition for Node.js. What is Deno? Why Deno can be considered an alternative to Node? The main differences between Deno and Node. Write a simple Deno app.

What is Deno? The Node.JS Killer? The Deno-minator to Node?

What is Deno? The Node.JS Killer? The Deno-minator to Node? Deno is the new hype and will it be better than node.js? Deno is a secure runtime for JavaScript and TypeScript that is based on the V8 JavaScript engine and the Rust programming language that addresses Node’s shortcomings