shockbs
v0.1.1114
Published
LOTS ultilities to upgrade your Discord Bot using SHOCK API !
Downloads
1,194
Maintainers
Keywords
Readme
Support Server
https://discord.gg/zeBet3HrU4
Getting Started
you can install ShockBS via npm:
npm i shockbs@latest
Getting your API Key
join the support server and visit api settings channel
Logging in with an API Key
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
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)
- click here for preview
- supports chat conversation:
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"));