Socket
Socket
Sign inDemoInstall

ksoft.js

Package Overview
Dependencies
Maintainers
1
Versions
51
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ksoft.js - npm Package Compare versions

Comparing version 1.0.9 to 1.1.0

lib/webhook/server.js

25

index.js

@@ -5,4 +5,25 @@ const { images } = require("./lib/apis/images")

const { lyrics } = require("./lib/apis/lyrics")
const ksoftAPI = class ksoftAPI {
constructor(token){
const Webhook = require("./lib/webhook/server")
/**
* @typedef {Object} webhookOptions webhook options
* @prop {Boolean} useWebhooks whether to use the webhook feature
* @prop {number} port webhook http server port
* @prop {String} Authentication Your webhook authentication
*/
class ksoftAPI{
/**
* @constructor
* @param {number} token Your ksoft api token
* @param {boolean} useWebhooks Whether you want to use the webhook feature
* @param {webhookOptions} webhookOptions webhook options
*/
constructor(token, webhookOptions){
/**
* The webhook class if useWebhooks is true
* @type {Webhook?}
*/
this.webhook = null
if(webhookOptions.useWebhooks){
this.webhook = new Webhook(webhookOptions.port, webhookOptions.Authentication)
}
this.images = new images(token)

@@ -9,0 +30,0 @@ this.bans = new bans(token)

7

package.json
{
"name": "ksoft.js",
"version": "1.0.9",
"version": "1.1.0",
"description": "Official API Wrapper for KSoft.Si API, written in Node.js",

@@ -29,3 +29,6 @@ "main": "index.js",

"axios": "^0.18.0",
"form-data": "^2.3.3"
"body-parser": "^1.18.3",
"express": "^4.16.4",
"form-data": "^2.3.3",
"public-ip": "^2.4.0"
},

@@ -32,0 +35,0 @@ "devDependencies": {

@@ -54,9 +54,9 @@ # ksoft.js

ksoft.bans.add({
user: "123456789741" ,
mod: "123456789742" ,
user_name: "SomeBadUsername" ,
user_discriminator: "#1234" ,
reason: "Your descriptive reason" ,
proof: "Your proof",
appeal_possible: true
user: String ,
mod: String ,
user_name: String ,
user_discriminator: String ,
reason: String ,
proof: String,
appeal_possible: Boolean
})

@@ -125,3 +125,30 @@ ```

## Webhook feature
This just requires adding a few things when we initiate ksoft.js
```javascript
const Ksoft = require("ksoft.js")
const ksoft = new Ksoft("your ksoft token", {
useWebhooks: true,
port: 2000, // this is the port the http server is going to run on. This can be whatever port you want I am just using 2000 as an example
Authentication: "your webhook authentication token"
})
ksoft.webhook.on("ready", info => {
console.log(info) // this will return the host your http server is running on. This is what you will give to ksoft to send the info to. { "host": "yourpublicip:theportyouspecified"}
})
```
that was just to get everything up and running now let's see how we can actually access that data. It's really simple :)
```javascript
// this is an extension of the previous example. Everything works on events so you can simply do this
ksoft.webhook.on('ban', banData => {
console.log(banData) // there you simply get the banInfo sent from ksoft. All the event names are the same as on the ksoft documentation so if you want more info just go to https://docs.ksoft.si/api/webhooks
})
```
Special thanks to sdf for helping me troubleshoot some stuff :)
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