Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

cuffeo

Package Overview
Dependencies
Maintainers
2
Versions
19
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cuffeo

A multi-protocol chatbot library with nearly zero dependencies.

  • 1.2.2
  • latest
  • npm
  • Socket score

Version published
Weekly downloads
19
Maintainers
2
Weekly downloads
 
Created
Source

cuffeo (wip)

Usage Example

import cuffeo from "cuffeo";

(async () => {
  const clients = [
    {
      type: "irc",
      enabled: true,
      network: "name",
      host: "localhost",
      port: 6697,
      ssl: true,
      selfSigned: false,
      sasl: false,
      nickname: "nickname",
      username: "username",
      password: "password",
      realname: "realname",
      channels: [
        "#blah"
      ]
    },
    {
      type: "tg",
      enabled: true,
      token: "token",
      pollrate: 1001
    },
    {
      type: "slack",
      enabled: true,
      token: "token"
    }
  ];

  const bot = await new cuffeo(clients);

  // events
  bot.on("message", msg => {
    msg.reply("hello, world!");
  });

  bot.on("info", msg => {
    console.log(msg);
  });

  bot.on("error", err => {
    console.error(err);
  });

  bot.on("ctcp:ping", msg => { // irc only
    msg.write(`notice ${msg.user.nick} :${e.message}`);
  });

  bot.on("ctcp:version", msg => { // irc only
    msg.write(`notice ${msg.user.nick} :\u0001VERSION blah\u00001`);
  });
})();

documentation

clients

irc
{
  "type": "irc",
  "enabled": true,
  "network": "name",
  "host": "localhost",
  "port": 6697,
  "ssl": true,
  "selfSigned": false,
  "sasl": false,
  "nickname": "nickname",
  "username": "username",
  "password": "password",
  "realname": "realname",
  "channels": [
    "#blah"
  ]
}
Telegram
{
  "type": "tg",
  "enabled": true,
  "token": "token",
  "pollrate": 1001
}
Slack
{
  "type": "slack",
  "enabled": true,
  "token": "token"
}

Events

message

returns an object, containing:

variabletypeexplanationnote
typestringirc, tg or slack
networkstringirc only, other it'll be "telegram" or "slack"
channelstring
userobjectsee below
messagestring
timestringtimestamp
rawobject
replyfunction
replyActionfunction
replyNoticefunction
selfobject
_chanobjectirc only
_userobjectirc and telegram only
joinfunctionjoin a channelirc only
partfunctionpart a channelirc only
whoisfunctionrequest a whoisirc only
writefunctionwrite raw lul

user object
variabletype
accountstring
prefixstring
reply/replyAction/replyNotice function
msg.reply("message");
msg.replyAction("message");
msg.replyNotice("message"); // same as reply() on Slack and Telegram
join function
msg.join("#channel");
part function
msg.part("#channel", "message");
// or
msg.part([ "#channel1", "#channel2" ], "message");
whois function
msg.whois("user");
// or
msg.whois([ "user1", "user2" ]);

color your messages

msg.reply("[color=red]message[/color]");

allowed colors:

  • white
  • black
  • navy
  • green
  • red
  • brown
  • purple
  • orange
  • yellow
  • lightgreen
  • teal
  • cyan
  • blue
  • magenta
  • gray
  • lightgray

bold and italic

msg.reply("[b]bold[/b]");
msg.reply("[i]italic[/i]");

Keywords

FAQs

Package last updated on 23 Apr 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc