npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

discord-communications

v1.0.4

Published

A communication system the comically models TCP Communication

Readme

discord-communications

A communication system for node.js that can be watched via discord.

Table of Contents

About

Was a bit bored and wanted to make a funny communication system, so... I did. Its modeled after TCP connections.

Example


discordComms = require("discord-communications");

require("dotenv/config");

client1 = new discordComms(
  process.env.CLIENT1_TOKEN,
  "855942709217984512",
  "Sync",
  "Ack",
  "Fin",
  "================================="
);

client1.addBot("818229925517590558", "857739636850556948", {
  ID: "855867486871486496",

  SYN: "sYNC",

  ACK: "aCK",

  FIN: "fIN",
});

client1.on("message", (m) => {
  console.log("Client1 received a message!");

  console.log(JSON.parse(m["message"]));
});

client1.on("messageFailed", (m) => {
  console.log(m);
});

client2 = new discordComms(
  process.env.CLIENT2_TOKEN,
  "855867486871486496",
  "sYNC",
  "aCK",
  "fIN",

  ":grinning: :grinning: :grinning: :grinning: :grinning: :grinning:"
);

client2.addBot("818229925517590558", "857739636850556948", {
  ID: "855942709217984512",

  SYN: "Sync",

  ACK: "Ack",

  FIN: "Fin",
});

const veryLargeObject = [
  [
    true,

    206524755.7646594,

    "watch",

    {
      recent: 1919212481.4359708,

      of: -1234194671,

      job: "fireplace",

      fastened: "tongue",

      prepare: [false, 422601777.6562691, "tower", "powerful", true],
    },

    [false, 83278634.86709356, 1508958168.5165505, false, false],
  ],
];

client2.on("ready", () => {
  client2.send("855942709217984512", veryLargeObject, (sc) => console.log(sc));
});

Discord:

Console:

enter image description here

Usage

Use the installation command:

npm i --save discord-communications

Client:

Methods:

  • constructor: client = discordComms(params) Creates the client object.

  • token: The discord bots token

  • id: The bots Client ID.

  • SYN: The message the bot will send to synchronize.

  • ACK: The message the bot will send to acknowledge.

  • FIN: The message the bot will send to finish.

  • separator: The message that the bot will send after a successful transaction to separate transactions on the Discord Chat.

  • getInfo: client.getInfo()Returns an object containing the ID, SYN, ACK, FIN information of the client.

  • addBot: client.addBot(params) Adds a bot that the client will communicate with.

  • guildID: The ID of the server/guild in which the client will communicate with the bot.

  • channelID: The ID of the channel in which the client will send messages to the bot.

  • botInfo: An object containing the ID, SYN, ACK, FIN properties of the bot.

  • send: client.send(params) Sends a message to a bot

  • id: The Client ID of the bot you want to send a message to.

  • messageToSend: The message/object you want to send to the Bot.

  • cb: The callback after the message is sent successfully/unsuccessfully. Passes a value of true if the message is successfully sent or false if the message is sent unsuccessfully.

Events:

  • message: client.on("message", function) When the client recieves a message

  • message: An object containing information about the transaction.

  • code: The transaction code(The code that separates transactions from one another).

  • id: The ID of the sender

  • state: The state of the message

  • message: A string with the object sent.

  • messageFailed: client.on("messageFailed", function) When the client failed to recieve a message.

  • message: An object containing information about the transaction.

  • code: The transaction code(The code that separates transactions from one another).

  • id: The ID of the sender

  • state: The state of the message

  • message: A string with the object sent.

  • ready: client.on("ready", function)When the discord client of the bot is ready.

Contributing

This is my first nodejs package, so feel free to make suggestions, and help me fix convention errors.