ksoft.js
Official API Wrapper for KSoft API, written in Node.js
Getting Started
installing...
npm install ksoft.js --save
initializing...
const Ksoft = require('ksoft.js');
const ksoft = new Ksoft(yourtoken, webhookOptions);
All functions
Images Api
ksoft.images.getRandomMeme();
ksoft.images.getRandomImage(tag);
ksoft.images.getTags();
ksoft.images.searchTags(tag);
ksoft.images.getImageFromId(snowflake);
ksoft.images.getRandomWikiHow(nsfw);
ksoft.images.getRandomCutePicture();
ksoft.images.getRandomNSFW();
ksoft.images.getRandomReddit(subReddit, removeNSFW, span);
Bans Api
ksoft.bans.add({
user: String,
mod: String,
user_name: String,
user_discriminator: String,
reason: String,
proof: String,
appeal_possible: Boolean,
});
ksoft.bans.getBanInfo(userID);
ksoft.bans.check(userID);
ksoft.bans.list(page, perPage);
ksoft.bans.getUpdate(epochDate);
ksoft.bans.bulkCheck(ids, {
moreInfo: Boolean,
bannedOnly: Boolean,
advancedBannedOnly: Boolean,
});
ksoft.bans.guildMembersCheck(guildMemberCollection, {
moreInfo: Boolean,
ignoreBots: Boolean,
});
Kumo Api
ksoft.kumo.search(q, {
fast: Boolean,
more: Boolean,
mapZoom: Number,
includeMap: Boolean,
});
ksoft.kumo.getSimpleWeather(reportType, q, units, lang, icons);
ksoft.kumo.geoip(ip);
ksoft.kumo.convertCurrency(from, to, value);
Lyrics Api
ksoft.lyrics.search(q, {
textOnly: Boolean,
limit: Number,
});
ksoft.lyrics.getArtistById(id);
ksoft.lyrics.getAlbumById(id);
ksoft.lyrics.getTrackById(id);
voiceConnection is the discord.js voiceConnection object you get when you connect to a voice channel. This command will search both youtube and the api for a song and if you provide a voice channel connection it will start playing the song and in the promise return the lyrics. This isn't 100% accurate so use at your own risk.
ksoft.lyrics.searchAndPlay(query, voiceConnection);
Webhook feature
This just requires adding a few things when we initiate ksoft.js
const Ksoft = require('ksoft.js');
const ksoft = new Ksoft('your ksoft token', {
useWebhooks: true,
port: 2000,
Authentication: 'your webhook authentication token',
});
ksoft.webhook.on('ready', info => {
console.log(info);
});
that was just to get everything up and running now let's see how we can actually access that data. It's really simple :)
ksoft.webhook.on('ban', banData => {
console.log(banData);
});
Using the BanCreator utility
const ban = new ksoft.CreateBan()
.setUserID('1234567892355822')
.setModID('44457845784574578')
.setUserName('blahblahblah')
.setUserDiscriminator('1234')
.setReason('testing123')
.setProof('proof')
.isAppealable(true);
ksoft.bans.add(ban).then(res => {
console.log(res);
});
Special thanks to sdf for helping me troubleshoot some stuff :)