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

cura-app.js

v1.0.3

Published

The official api wrapper for cura-app.tk

Downloads

9

Readme

Cura-app.js, API Wrapper for cura-app.tk

The official api wrapper for cura-app.tk

Functionality

  • [X] Events
  • [X] Login
  • [X] Invite Generator
  • [X] Internal Command Handler
  • [X] Send, reply to messages
  • [X] Emulate Typing

Modify for use with your copy of CuraApp

Before logging in do client.socketUrl = "wss://example.com"

In the case of use with the official cura-app.tk this is not required!

Syntax

client.login(token)

This is required to login to the client

let Cura = require("cura-app.js");
let client = new Cura();

client.login("xb:------------");

client.command(options)

This is used for the internal command handler, easy for beginners.

    client.command({ //!ping returns Pong!
    name: "ping",
    message: "Pong!"
})

client.command({
    name: "echo",
    run: (message, args) => { //Run functions using run you can get message object and args
        message.startTyping(); //Start typing
        message.reply(args.join(" ")); //Reply with all arguments
    }
})

client.send(content, guildId, channelId)

Send a message to a channel

client.send("Hello there", "e8ef0db5-bdf6-4624-b22b-7b85928bfcec", "fee5fceb-f7fd-42bf-96e8-dc8daefa6fa2")

client.typeStart(channelId, guildId)

Start typing.

    client.typeStart("e8ef0db5-bdf6-4624-b22b-7b85928bfcec", "fee5fceb-f7fd-42bf-96e8-dc8daefa6fa2");

client.typeStop(channelId, guildId)

Start typing.

    client.typeStop("e8ef0db5-bdf6-4624-b22b-7b85928bfcec", "fee5fceb-f7fd-42bf-96e8-dc8daefa6fa2");

Events

ready

When the bot is ready and connected to ws.

client.on("ready", (raw)=>{}) (returns raw data)

message

When you recieve a message in a guild

client.on("message", (MessageObject)=>{}) (returns MessageObject)

typingStart

When someone starts typing

client.on("typingStart", (data)=>{data.username}) (returns username)

Do note that you will have to handle if no typing event for 5 seconds stop typing, this event also gets sent every keystroke

typingStop

When someone stops typing

client.on("typingStop", (data)=>{data.username}) (returns username)

Objects

MessageObject

{
  id: 'messageId',
  guild: boolean,
  guildObject: guildObject,
  channel: channelObject,
  author: userObject,
  content: 'messageContent',
  str: null,
  html: 'messageHtml',
  member: userObject,
  bot: boolean,
  startTyping: MessageObject.stopTyping(),
  stopTyping: MessageObject.startTyping(),
  reply: MessageObject.reply(content)
}

GuildObject

{ 
 id: 'guildId', 
 name: 'guildName' 
}

UserObject

{
 id: 'userId',
 username: 'userName',
 badges: { mod: boolean, bot: { is: boolean, verified: boolean } },
 bot: boolean
 }

ChannelObject

{
 name: 'channelName',
 id: 'channelId'
}

Internal Variables

client.rooms

A variable with all dm's/guilds

[GuildID, GuildID]

client.token

The client's token

xb:-------

client.socketUrl

URL of socket to connect to

wss://cura-app.tk

client.prefix

Prefix for internal command handler

!

client.ready

Is the client ready

boolean

Examples

Echo Command

let Cura = require("cura-app.js");
let client = new Cura();

client.on("ready", (data) => {
    console.log("Your bot is now online!");
})

client.command({
    name: "echo",
    run: (message, args) => {
        message.startTyping();
        message.reply(args.join(" "));
    }
})

client.login(``);