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 🙏

© 2024 – Pkg Stats / Ryan Hefner

msgroom-bot-api-renew

v1.0.5

Published

Revival of the msgroom-bot-api package that has been deprecated long ago

Downloads

19

Readme


Installation

To use the msgroom-bot-api-renew module, you need to have Node.js installed. You can then install the module using npm:

npm i msgroom-bot-api-renew

Client API

command(cmd,func)

Creates a command in the bot.

  • cmd (string) : The command name including the prefix
  • func (function) : The function for the command The arguments passed to func:
  • first argument - args of the command
  • second argument - the message event

connect(nick, apikey, url, bottag)

Connects the bot client to the server.

  • nick (string): The username or nickname of the bot.
  • apikey (string): The API key for authentication.
  • url (string | URL): (Optional) The URL of the server to connect to. Defaults to wss://windows96.net:4096.
  • bottag (bool): (Optional) If true, the bot has a Bot tag. ONLY WORKS ON NOLANWHY's MRCS. Defaults to true.

Returns a promise that resolves when the connection is successful or rejects with an error if there is an issue.

send(msg)

Sends a message from the bot client to the server.

  • msg (string): The message content to send.

setName(nick)

Changes the bot's name to the specified value.

  • nick (string): The new name for the bot.

disconnect(kill)

Disconnects the bot client from the server, and kills the process.

  • kill if true, it kills the process after disconnection.

defaultAdminCommandsTemplate(id,prefix,botname,expressClass)

Initializes a default admin command template (not using this.command(..))

  • id (string): The id of the person that can run the admin commands.
  • prefix (string): The prefix of the commands.
  • botname (string): The name of the bot, it is used in command outputs.
  • expressClass (class): The express class. Put it in only if you are using one. Commands in template: say - makes the bot say whatever is in argument 1 name - renames the bot's user to whatever is in argument 1 shutdown - shuts the bot down chpspawn - spawns process with whatever commandline you put, only works on windows disconnectexpress - stops the express server you put into expressClass eval - evaluates js in arg 1

username

The bot's user name

SOCKET

The Websocket connection to the msgroom server

userId

The bot's userID

constatus

The bot's connection preferences

msglimit

The amount of messages you are allowed to send before resetinterval resets the count. Changing this value crashes the bot. Every millisecond a check is ran to crash the bot if messages is larger than msglimit.

resetinterval

The interval value for resetting the messages value back to 0. Changing this value crashes the bot. this.resetinterval = 1500;

messages

The amount of messages you sent. This is reset every time a resetinterval passes.

botParser API

parseArguments(string)

Parses arguments from a command string into an array. Spaces are splitters, and a substring with spaces wrapped into quotes or double quotes gets parsed as a normal argument. hello there would return ["hello","there"], while "hello there" how are you would return ["hello there","how","are","you"]

safeParseJSON(string)

Safely parses a JSON string aka returns -1 on error

safeUnparseJSON(object)

Safely stringifies JSON aka returns -1 on error

parseEntity(string)

Parses HTML Entities into a normal string

encode(string,encoding)

Encodes a string

decode(string,encoding)

Decodes a string

Express API

routeResponseFile(path, file)

Same thing as this.app.get(path, (req, res)=>{ res.sendFile(file) });

routeResponse(path, input)

Same thing as this.app.get(path, (req, res)=>{ res.send(input) });

start()

Starts Express server

stop()

Stop Express server

app

The express app

port

The port number.

server

start() assigns the value returned by app.listen() to this, it is used for stop()

License

This module is released under the MIT License.