Socket
Socket
Sign inDemoInstall

ksoft.js

Package Overview
Dependencies
2
Maintainers
2
Versions
51
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 2.2.1 to 2.3.0

2

lib/structures/Album.js
class Album {
constructor(name, id, year, artist, tracks) {
this.name = name;
this.id = parseInt(id) > 0 ? parseInt(id) : null;
this.id = parseInt(id) > 0 ? id : null;
this.year = parseInt(year);

@@ -6,0 +6,0 @@ this.artist = null;

class Artist {
constructor(name, id, albums, tracks) {
this.name = name;
this.id = parseInt(id) > 0 ? parseInt(id) : null;
this.id = parseInt(id) > 0 ? id : null;
this.albums = [];

@@ -6,0 +6,0 @@ if (albums && albums.length) {

@@ -8,4 +8,4 @@ class BannedUser {

toJSON() {
return;
toString() {
return `<@${this.id}>`;
}

@@ -12,0 +12,0 @@ }

@@ -5,3 +5,2 @@ const Location = require('./Location');

constructor({ city, country_name: country, latitude, longitude, apis }) {
this.location = new Location(latitude, longitude, `${city}, ${country}`)

@@ -8,0 +7,0 @@ this.map = apis.googlemaps;

class Track {
constructor(name, id, artist, albums, lyrics) {
this.name = name;
this.id = parseInt(id) > 0 ? parseInt(id) : null;
this.id = parseInt(id) > 0 ? id : null;
this.artist = null;

@@ -6,0 +6,0 @@ if (artist) {

{
"name": "ksoft.js",
"version": "2.2.1",
"version": "2.3.0",
"description": "Official Node.js Wrapper for the KSoft.Si API.",

@@ -5,0 +5,0 @@ "main": "src/index.js",

# ksoft.js
# Documentation WIP.
## Install
This is the official Node.js Wrapper for the KSoft.Si API.
`npm i ksoft.js`
## Usage
**All API calls are async. You have to put them into an async function, and await them. Else, they will return a Promise.**
## Documentation
Example:
```js
const { KSoftClient } = require('ksoft.js');
const ksoft = new KSoftClient('your-very-nice-token');
async function test () {
const aww = await ksoft.images.aww();
message.send(aww.url);
}
test();
```
## Ban Builder
For `ksoft.bans.add`, I have included a ban builder, which makes it considerably easier to send a ban request to KSoft.
API:
```ts
ban.setUser(id: Snowflake, name: String, discriminator: String);
ban.setReason(reason: String, proof: URL);
ban.setModerator(id: Snowflake);
```
Example:
```js
const { Ban, KSoftClient } = require('ksoft.js');
const ksoft = new KSoftClient('your-very-nice-token');
const ban = new Ban()
.setUser('123456789123456789', 'Wumpus', '0001')
.setReason('Bad Raider', 'https://i.imgur.com/ban_em_already')
.setModerator('102102717165506560');
ksoft.bans.add(ban);
```
## APIs
### Bans
#### Add Ban
```ts
ksoft.bans.add(ban: Ban);
```
Response:
```js
Promise<{ success: true } | {success: false, message: '[error that occured]'}>
```
---
#### Get Ban Info
```ts
ksoft.bans.info(id: Snowflake);
```
Response:
```js
Promise<Ban>
```
---
You can find the docs [here](https://js.docs.ksoft.si).
SocketSocket SOC 2 Logo

Product

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

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc