smart-chatbot
Advanced tools
Comparing version 0.0.9 to 0.1.0
17
main.js
@@ -7,4 +7,10 @@ const axios = require("axios"); | ||
class Client { | ||
constructor(secret, botname, logging = false) { | ||
constructor(mainjson) { | ||
let logging; | ||
if(!mainjson.logging || mainjson.logging != true) { | ||
logging = false; | ||
} else { | ||
logging = true; | ||
} | ||
if(logging == true) | ||
@@ -15,3 +21,6 @@ console.log(`[${packagename}] Enabling..`); | ||
return new Promise(async(resolve, reject) => { | ||
if(!mainjson.secretkey || typeof mainjson.secretkey !== "string") return console.error("[" + packagename + "] Secret Key Problem"); | ||
if(!mainjson.botname || typeof mainjson.secretkey !== "string") return console.error("[" + packagename + "] Bot Name Problem"); | ||
if(!mainjson.ownername || typeof mainjson.secretkey !== "string") return console.error("[" + packagename + "] Owner Name Problem"); | ||
if(!json.message || typeof json.message !== "string") reject("No message was provided"); | ||
@@ -21,5 +30,5 @@ if(!json.user || typeof json.user !== "number") json.user = 1; | ||
axios.get(`${baseURL}/chatbot?message=${encodeURIComponent(json.message)}&user=${encodeURIComponent(json.user)}&language=${encodeURIComponent(json.language)}&botname=${encodeURIComponent(botname)}`, { | ||
axios.get(`${baseURL}/chatbot?message=${encodeURIComponent(json.message)}&user=${encodeURIComponent(json.user)}&language=${encodeURIComponent(json.language)}&botname=${encodeURIComponent(mainjson.botname)}&ownername=${encodeURIComponent(mainjson.ownername)}`, { | ||
headers: { | ||
'Authorization': `${secret}`, | ||
'Authorization': `${mainjson.secretkey}`, | ||
'Version': `${version}`, | ||
@@ -26,0 +35,0 @@ 'using': "npm" |
{ | ||
"name": "smart-chatbot", | ||
"version": "0.0.9", | ||
"description": "Intelligent Chat Bot Api", | ||
"main": "main.js", | ||
"scripts": { | ||
"start": "node main.js" | ||
}, | ||
"keywords": [ | ||
"smart", | ||
"chatbot", | ||
"chat-bot", | ||
"artificial", | ||
"intelligence", | ||
"discord chatbot" | ||
], | ||
"author": "bucksh0t", | ||
"license": "Apache-2.0", | ||
"bugs": { | ||
"url": "https://github.com/CsYBot/smart-chatbot/issues" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/CsYBot/smart-chatbot.git" | ||
}, | ||
"homepage": "https://github.com/CsYBot/smart-chatbot/issues#readme", | ||
"dependencies": { | ||
"axios": "^0.24.0" | ||
} | ||
} | ||
"name": "smart-chatbot", | ||
"version": "0.1.0", | ||
"description": "Intelligent Chat Bot Api", | ||
"main": "main.js", | ||
"scripts": { | ||
"start": "node main.js" | ||
}, | ||
"keywords": [ | ||
"smart", | ||
"chatbot", | ||
"chat-bot", | ||
"artificial", | ||
"intelligence", | ||
"discord chatbot", | ||
"bdfd", | ||
"yapayzeka", | ||
"aoi.js" | ||
], | ||
"author": "bucksh0t", | ||
"license": "Apache-2.0", | ||
"bugs": { | ||
"url": "https://github.com/CsYBot/smart-chatbot/issues" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/CsYBot/smart-chatbot.git" | ||
}, | ||
"homepage": "https://github.com/CsYBot/smart-chatbot/issues#readme", | ||
"dependencies": { | ||
"axios": "^0.24.0" | ||
} | ||
} |
@@ -10,3 +10,3 @@ <p align="center"><a href="https://nodei.co/npm/smart-chatbot"><img src="https://nodei.co/npm/smart-chatbot.png"></a></p> | ||
const chatbot = require("smart-chatbot"); | ||
const chatclient = new chatbot.Client("SECRET KEY", "BOT NAME"); | ||
const chatclient = new chatbot.Client({ secretkey: "SECRET KEY", botname: "BOT NAME", ownername: "OWNER NAME" }); | ||
@@ -20,4 +20,42 @@ chatclient.chat({ | ||
**Aoi.js & Dbd.js:** | ||
```js | ||
bot.command({ | ||
name: "$alwaysExecute", | ||
code: `$djsEval[ | ||
const chatbot = require("smart-chatbot") | ||
const chatclient = new chatbot.Client({ secretkey: "SECRET KEY", botname: "BOT NAME", ownername: "OWNER NAME" }); | ||
let question = message.content.split(" ").slice(1).join(" "); | ||
if(!question || String(question) == String([])) { | ||
message.channel.send("❌ Please Message ❌"); | ||
} else { | ||
chatclient.chat({ | ||
message: question, | ||
user: message.author.id, | ||
language: "tr" // (tr, en) | ||
}).then(x => message.channel.send(x)).catch(err => message.channel.send("ERR API Problem!")); | ||
}] | ||
$onlyIf[$mentioned[1]==$clientID;] | ||
` | ||
}); | ||
``` | ||
**Bdfd API (BDSCRPT 2):** | ||
```txt | ||
$nomention | ||
$botTyping | ||
$try | ||
$httpAddHeader[Authorization;SECRET_KEY] | ||
$httpAddHeader[Version;0.0.9] | ||
$httpAddHeader[using;bdfd] | ||
$httpGet[https://api.csycraft.xyz/chatbot?user=$authorID&language=tr&botname=CsYBot&message=$replaceText[$replaceText[$replaceText[$replaceText[$replaceText[$replaceText[$message;ı;i];ö;o];ğ;g];ü;u];ç;c];ş;s]] | ||
$httpResult[message] | ||
$catch | ||
Üzgünüm cevap veremedim. | ||
$endtry | ||
$argsCheck[>1;Please Enter Message] | ||
``` | ||
**What is SECRET KEY?** | ||
For Secret Key Join Server: https://discord.gg/gkmwaAZQBu |
@@ -10,3 +10,3 @@ const Discord = require("discord.js"); | ||
const chatbot = require("smart-chatbot"); | ||
const chatclient = new chatbot.Client("SECRET KEY", "BOT NAME"); | ||
const chatclient = new chatbot.Client({ secretkey: "SECRET KEY", botname: "BOT NAME", ownername: "OWNER NAME" }); | ||
@@ -13,0 +13,0 @@ client.on("message", async(message) => { |
const chatbot = require("smart-chatbot"); | ||
const chatclient = new chatbot.Client("SECRET KEY", "BOT NAME"); | ||
const chatclient = new chatbot.Client({ secretkey: "SECRET KEY", botname: "BOT NAME", ownername: "OWNER NAME" }); | ||
@@ -8,2 +8,2 @@ chatclient.chat({ | ||
language: "tr" // (tr, en) | ||
}).then(answer => console.log); | ||
}).then(answer => console.log(answer)); |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
19822
8
98
59