New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

cassidy-bridge

Package Overview
Dependencies
Maintainers
0
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cassidy-bridge

A bridge for Cassidy bot to handle database queries and interactions.

latest
npmnpm
Version
1.0.2
Version published
Maintainers
0
Created
Source

Cassidy Bridge

Cassidy Bridge is a library designed to facilitate database queries and interactions for the Cassidy bot. It uses axios to communicate with a specified URL and handles data retrieval and storage efficiently.

Table of Contents

  • Installation
  • Usage
  • API
  • Examples
  • License

Installation

To install cassidy-bridge, you can use npm:

npm install cassidy-bridge

Usage

First, require the package in your project:

const CassidyBridge = require("cassidy-bridge");

You can create an instance of CassidyBridge by providing the necessary parameters.

const bridge = new CassidyBridge({
  onGetAllData: yourGetAllDataFunction,
  onSetEachData: yourSetEachDataFunction,
});

API

CassidyBridge

The main class for interacting with the Cassidy bot.

Constructor:

url (String): The URL to send requests to (default: https://cassidybot.onrender.com).

onGetAllData (Function): A function to retrieve all user data.

onSetEachData (Function): A function to set each user's data.

sendQuery

Method: async sendQuery(event)

Parameters:

event (Object): The event data to be sent with the query.

Returns: The result from the server or null in case of an error.

goatQuery

Method: async goatQuery(message, event)

Parameters:

message (Object): The message object for responding to events.

event (Object): The event data to be processed.

Returns: A reply or send message based on the result.

fromGoatBot

Static Method: static fromGoatBot({ usersData, ...etc })

Parameters:

usersData (Object): An object to manage user data.

Returns: An instance of CassidyBridge.

Examples

Creating an Instance

Here's an example of how to create a CassidyBridge instance with user data functions:

const usersData = { getAll: async () => { // Function to retrieve all user data }, set: async (userID, data, type) => { // Function to set user data } };

const bridge = CassidyBridge.fromGoatBot({ usersData });

Sending a Query

You can send a query using the goatQuery method:

const message = { reply: (body) => console.log("Reply:", body), send: (body) => console.log("Send:", body), };

const event = { action: "someAction" };

bridge.goatQuery(message, event);

Keywords

cassidy

FAQs

Package last updated on 09 Oct 2024

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