shockbs

0.1.1114 • Public • Published

ShockBS

ShockBS


Node version contributions welcome HitCount Vulnerabilities License: CC BY-NC 4.0 GitHub Workflow Status Repo Size PRs Welcome FOSSA Statusnpm License Contributors Size Package ShockBS Npm package version Npm package monthly downloads Npm package daily downloads Npm package total downloads Npm package dependents GitHub release GitHub commits GitHub latest commit GitHub forks GitHub stars GitHub watchers GitHub issues GitHub issues-closed Discord Shock Discord ForTheBadge uses-git ForTheBadge uses-js ForTheBadge built-with-love ForTheBadge built-by-developers Open Source Love svg3 Npm Visual Studio Code GitHub made-with-Markdown Maintenance

Features

  • • Various Games for Discord Bots
  • • Unrestricted Unlimited Free AI including GPT-4
  • • Custom AI Personality
  • • Performant
  • • Reliable
  • • Customizable
  • • Compatible with Both TS and CJS/MJS Environments

https://discord.gg/zeBet3HrU4

you can install ShockBS via npm:

npm i shockbs@latest

join the support server and visit api settings channel

import shockbs from "shockbs";
// const shockbs = require("shockbs");
try {
    shockbs.login(process.env.ShockBS_APIKEY);
} catch(err) {
    console.error("Unable to log in, reason: "+err.message);
}

You only need to call login() once, it's recommended to do that on your main file

Checking if you are already logged in

import shockbs from "shockbs";
// const shockbs = require("shockbs");
const loggedIn = shockbs.loggedIn();
if (loggedIn === true) {
    console.log("Already Logged In");
} else {
    console.error("[Shock API] Not Logged In Yet");
}

GuessThePokemon Game

Demo guessThePokemonGame

import shockbs from "shockbs";
// const shockbs = require("shockbs");
new shockbs.guessThePokemonGame({
    base: interaction, // required, can be either message or interaction
    baseType: "Interaction" // required, the type of base, can be either message or interaction, case-insensitive
    embed: {
        title: "Who's the Pokemon?", // optional, string, the title of embed
        color: "#F600FF", // optional, string, the color of embed
        winMessage: "You're right! The Pokemon is ${pokemonName}.", // optional, title when user guessed the correct pokemon name, ${pokemonName} will be replaced with the correct pokemon name
        loseMessage: "You're wrong! Please try again.", // optional, string
        timeoutMessage: "You didn't respond in time. The pokemon was ${pokemonName}." // optional, string, ${pokemonName} will be replaced with the correct pokemon name
    },
    button: {
        text: "Input Answer", // optional, string
        style: ButtonStyle.Primary, // optional
        emoji: null, // optional
    },
    time: "half minute", //optional
}).startGame();

GPT-4 / GPT-3.5 / GPT-3 (FREE & Unlimited)

first initialize gptChat

import shockbs from "shockbs";
// const shockbs = require("shockbs");

const chatData = new shockbs.gptChat({
    model: "GPT-4", // available models: gpt-4, gpt-3.5, gpt-3
    replyMention: false, //whether to mention on reply
    maxInteractions: 30, // max interactions with the ai before clearing conversation history
    components: null, // extra components
    custom: false, // whether to use custom GPT personality
    embed: {
        color: "#FF00F6"
    }
})

custom trained GPT trained from API Panel:

new shockbs.gptChat({
    ...[data],
    custom: true, // enables custom trained gpt, supports all models
})

available models: gpt-4, gpt-3.5, gpt-3

and now you can attach it to your bot client for easy use (optional):

client.shockChat = chatData;

processing messages:

if (!(message.mentions?.users?.first() || {id:false}).id === client.user.id || !message.content?.length) return;
message.channel.startTyping();
await client.shockChat.message(message);

clearing all conversation history:

client.shockChat.clear().then(()=> console.log("Cleared Conversation History"));

clearing a person's conversation history:

const result = await client.shockChat.clearConversation(interaction.user.id);
if (result) {
    console.log("success");
} else {
    console.log("failed");
}

getting a person's conversation history:

client.shockChat.getData(interaction.user.id).then(data=> console.log(data));

getting a person's chat interactions count:

console.log(await client.shockChat.getCount(interaction.user.id));
  • text generation only:
import shockbs from "shockbs";
// const shockbs = require("shockbs");

//gpt4
console.log(await shockbs.gptText("Why does OpenAI not having traditional CEO?","gpt4"));
//gpt3.5
console.log(await shockbs.gptText("Write me a poem of stars.","gpt3.5"));
//gpt3
console.log(await shockbs.gptText("Guide me to make a watermelon spaghetti.","gpt3"));

Star History

Star History Chart

Package Sidebar

Install

npm i shockbs

Weekly Downloads

98

Version

0.1.1114

License

CC-BY-NC 4.0

Unpacked Size

58.8 kB

Total Files

11

Last publish

Collaborators

  • shockbs