-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #18 from Lebyy/develop
🎉 | Release 3.0.0
- Loading branch information
Showing
4 changed files
with
341 additions
and
282 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
const base = "https://api.affiliateplus.xyz/api"; | ||
const base = "https://api.lebyy.me/api"; | ||
const translatte = require("translatte"); | ||
const superagent = require("superagent"); | ||
/** | ||
|
@@ -7,9 +7,17 @@ const superagent = require("superagent"); | |
* @class Client | ||
*/ | ||
class Client { | ||
constructor() { | ||
constructor(token) { | ||
if (!token) throw new Error("No token provided!"); | ||
|
||
/** | ||
* The function to fetch respone from the Affiliate+ API | ||
* The token of the API | ||
* @type {string} | ||
*/ | ||
this.token = token; | ||
|
||
/** | ||
* The function to fetch respone from the Lebyy API | ||
* @type {Function} | ||
* @ignore | ||
* @private | ||
|
@@ -21,6 +29,7 @@ class Client { | |
( | ||
await superagent | ||
.get(`${base}/chatbot?${new URLSearchParams(ops).toString()}`) | ||
.set("Authorization", this.token) | ||
.type("json") | ||
.accept("json") | ||
).body.message | ||
|
@@ -35,6 +44,7 @@ class Client { | |
const englishResponse = ( | ||
await superagent | ||
.get(`${base}/chatbot?${new URLSearchParams(ops).toString()}`) | ||
.set("Authorization", this.token) | ||
.type("json") | ||
.accept("json") | ||
).body.message; | ||
|
@@ -53,163 +63,186 @@ class Client { | |
/** | ||
* @param {object} ops - The options | ||
* @param {string} ops.message - The message | ||
* @param {string} ops.name - The name of the bot | ||
* @param {string} ops.master - The master of the bot | ||
* @param {string | number | bigint} ops.user - The user id | ||
* @param {string} ops.language - The language of the returned reponse | ||
* @param {string} ops.age - The age of the bot. | ||
* @param {string} ops.birthyear - The birth year of the bot. | ||
* @param {string} ops.vocabulary - The vocabulary count of the bot. | ||
* @param {string} ops.baseballteam - The baseball team of the bot. | ||
* @param {string} ops.birthdate - The birth date of the bot. | ||
* @param {string} ops.birthday - The birthday of the bot. | ||
* @param {string} ops.birthplace - The birthplace of the bot. | ||
* @param {string} ops.build - The build version of the bot. | ||
* @param {string} ops.celebrities - The celebrities of the bot. | ||
* @param {string} ops.chinesesign - The chinese sign of the bot. | ||
* @param {string} ops.city - The city of the bot. | ||
* @param {string} ops.class - The class of the bot. | ||
* @param {string} ops.company - The company of the bot. | ||
* @param {string} ops.country - The country of the bot. | ||
* @param {string} ops.email - The email of the bot. | ||
* @param {string} ops.ethics - The ethics of the bot. | ||
* @param {string} ops.etype - The etype of the bot. | ||
* @param {string} ops.family - The family of the bot. | ||
* @param {string} ops.job - The job of the bot. | ||
* @param {string} ops.favoriteactor - The favorite actor of the bot. | ||
* @param {string} ops.favoriteactress - The favorite actress of the bot. | ||
* @param {string} ops.favoriteartist - The favorite artist of the bot. | ||
* @param {string} ops.favoriteauthor - The favorite author of the bot. | ||
* @param {string} ops.favoriteband - The favorite band of the bot. | ||
* @param {string} ops.favoritebook - The favorite book of the bot. | ||
* @param {string} ops.favoritecolor - The favorite color of the bot. | ||
* @param {string} ops.favoritefood - The favorite food of the bot. | ||
* @param {string} ops.favoritemovie - The favorite movie of the bot. | ||
* @param {string} ops.favoriteopera - The favorite opera of the bot. | ||
* @param {string} ops.favoriteseason - The favorite season of the bot. | ||
* @param {string} ops.favoriteshow - The favorite show of the bot. | ||
* @param {string} ops.favoritesong - The favorite song of the bot. | ||
* @param {string} ops.favoritesport - The favorite sport of the bot. | ||
* @param {string} ops.favoritesubject - The favorite subject of the bot. | ||
* @param {string} ops.footballteam - The football team of the bot. | ||
* @param {string} ops.forfun - The forfun activity of the bot. | ||
* @param {string} ops.friend - The friend of the bot. | ||
* @param {string} ops.friends - The friends of the bot. | ||
* @param {string} ops.gender - The gender of the bot. | ||
* @param {string} ops.genus - The genus of the bot. | ||
* @param {string} ops.hockeyteam - The hockeyteam of the bot. | ||
* @param {string} ops.kindmusic - The kindmusic of the bot. | ||
* @param {string} ops.language - The language of the bot. | ||
* @param {string} ops.location - The location of the bot. | ||
* @param {string} ops.ndevelopers - The ndevelopers of the bot. | ||
* @param {string} ops.nclients - The nclients of the bot. | ||
* @param {string} ops.orientation - The orientation of the bot. | ||
* @param {string} ops.os - The os of the bot. | ||
* @param {string} ops.party - The party of the bot. | ||
* @param {string} ops.phylum - The phylum of the bot. | ||
* @param {string} ops.physicallocation - The physicallocation of the bot. | ||
* @param {string} ops.president - The president of the bot. | ||
* @param {string} ops.religion - The religion of the bot. | ||
* @param {string} ops.scchinesesign - The scchinesesign of the bot. | ||
* @param {string} ops.sccity - The sccity of the bot. | ||
* @param {string} ops.sccompany - The sccompany of the bot. | ||
* @param {string} ops.sccountry - The sccountry of the bot. | ||
* @param {string} ops.scfavoritecolor - The scfavoritecolor of the bot. | ||
* @param {string} ops.scfavoritefood - The scfavoritefood of the bot. | ||
* @param {string} ops.scgender - The scgender of the bot. | ||
* @param {string} ops.scmaster - The scmaster of the bot. | ||
* @param {string} ops.scnationality - The scnationality of the bot. | ||
* @param {string} ops.scsign - The scsign of the bot. | ||
* @param {string} ops.scspecies - The scspecies of the bot. | ||
* @param {string} ops.sign - The sign of the bot. | ||
* @param {string} ops.species - The species of the bot. | ||
* @param {string} ops.state - The state of the bot. | ||
* @param {string} ops.totalclients - The totalclients of the bot. | ||
* @param {string} ops.version - The version of the bot. | ||
* @param {string} ops.wear - The wear of the bot. | ||
* @param {string} ops.wechat - The wechat of the bot. | ||
* @param {string} ops.name - The name of the chatbot | ||
* @param {string} ops.master - The master of the chatbot | ||
* @param {string} ops.age - The age of the chatbot | ||
* @param {string} ops.friends - The friends of the chatbot | ||
* @param {string} ops.botmaster - The botmaster of the chatbot | ||
* @param {string} ops.boyfriend - The boyfriend of the chatbot | ||
* @param {string} ops.genus - The genus of the chatbot | ||
* @param {string} ops.size - The size of the chatbot | ||
* @param {string} ops.species - The species of the chatbot | ||
* @param {string} ops.location - The location of the chatbot | ||
* @param {string} ops.order - The order of the chatbot | ||
* @param {string} ops.birthday - The birthday of the chatbot | ||
* @param {string} ops.kingdom - The kingdom of the chatbot | ||
* @param {string} ops.gender - The gender of the chatbot | ||
* @param {string} ops.favoritefood - The favoritefood of the chatbot | ||
* @param {string} ops.emotions - The emotions of the chatbot | ||
* @param {string} ops.mother - The mother of the chatbot | ||
* @param {string} ops.state - The state of the chatbot | ||
* @param {string} ops.nationality - The nationality of the chatbot | ||
* @param {string} ops.country - The country of the chatbot | ||
* @param {string} ops.city - The city of the chatbot | ||
* @param {string} ops.phylum - The phylum of the chatbot | ||
* @param {string} ops.domain - The domain of the chatbot | ||
* @param {string} ops.family - The family of the chatbot | ||
* @param {string} ops.vocabulary - The vocabulary of the chatbot | ||
* @param {string} ops.class - The class of the chatbot | ||
* @param {string} ops.email - The email of the chatbot | ||
* @param {string} ops.kindmusic - The kindmusic of the chatbot | ||
* @param {string} ops.favoritemovie - The favoritemovie of the chatbot | ||
* @param {string} ops.language - The language spoken by chatbot | ||
* @param {string} ops.job - The job of the chatbot | ||
* @param {string} ops.birthplace - The birthplace of the chatbot | ||
* @param {string} ops.religion - The religion of the chatbot | ||
* @param {string} ops.party - The party of the chatbot | ||
* @param {string} ops.celebrities - The celebrities of the chatbot | ||
* @param {string} ops.arch - The arch of the chatbot | ||
* @param {string} ops.version - The version of the chatbot | ||
* @param {string} ops.talkabout - The talkabout topic of the chatbot | ||
* @param {string} ops.website - The website of the chatbot | ||
* @param {string} ops.favoritebook - The favoritebook of the chatbot | ||
* @param {string} ops.favoritesport - The favoritesport of the chatbot | ||
* @param {string} ops.favoritesong - The favoritesong of the chatbot | ||
* @param {string} ops.hockeyteam - The hockeyteam of the chatbot | ||
* @param {string} ops.favoritecolor - The favoritecolor of the chatbot | ||
* @param {string} ops.favoriteshow - The favoriteshow of the chatbot | ||
* @param {string} ops.favoriteopera - The favoriteopera of the chatbot | ||
* @param {string} ops.favoriteactor - The favoriteactor of the chatbot | ||
* @param {string} ops.favoritetea - The favoritetea of the chatbot | ||
* @param {string} ops.favoriteactress - The favoriteactress of the chatbot | ||
* @param {string} ops.favoriteoccupation - The favoriteoccupation of the chatbot | ||
* @param {string} ops.favoriteseason - The favoriteseason of the chatbot | ||
* @param {string} ops.favoriteartist - The favoriteartist of the chatbot | ||
* @param {string} ops.favoriteauthor - The favoriteauthor of the chatbot | ||
* @param {string} ops.favoriteband - The favoriteband of the chatbot | ||
* @param {string} ops.favoritephilosopher - The favoritephilosopher of the chatbot | ||
* @param {string} ops.favoritesubject - The favoritesubject of the chatbot | ||
* @param {string} ops.forfun - The forfun activity of the chatbot | ||
* @param {string} ops.build - The build of the chatbot | ||
* @param {string} ops.etype - The etype of the chatbot | ||
* @param {string} ops.sign - The sign of the chatbot | ||
* @param {string} ops.looklike - The looklike of the chatbot | ||
* @param {string} ops.wear - The wear of the chatbot | ||
* @param {string} ops.os - The os of the chatbot | ||
* @param {string} ops.question - The question of the chatbot | ||
* @param {string} ops.dailyclients - The dailyclients of the chatbot | ||
* @param {string} ops.nclients - The nclients of the chatbot | ||
* @param {string} ops.totalclients - The totalclients of the chatbot | ||
* @param {string} ops.birthdate - The birthdate of the chatbot | ||
* @param {string} ops.ndevelopers - The ndevelopers of the chatbot | ||
* @param {number} ops.memory - The memory of the chatbot | ||
* @param {string} ops.alignment - The alignment of the chatbot | ||
* @param {string} ops.celebrity - The celebrity of the chatbot | ||
* @param {string} ops.favoritequestion - The favoritequestion of the chatbot | ||
* @param {string} ops.feelings - The feelings of the chatbot | ||
* @param {string} ops.footballteam - The footballteam of the chatbot | ||
* @param {string} ops.friend - The friend of the chatbot | ||
* @param {string} ops.girlfriend - The girlfriend of the chatbot | ||
* @param {string} ops.hair - The hair of the chatbot | ||
* @param {string} ops.hourlyqueries - The hourlyqueries of the chatbot | ||
* @param {string} ops.maxclients - The maxclients of the chatbot | ||
* @param {string} ops.orientation - The orientation of the chatbot | ||
* @param {string} ops.president - The president of the chatbot | ||
* @param {string} ops.richness - The richness of the chatbot | ||
* @param {string} ops.ethics - The ethics of the chatbot | ||
* @param {string} ops.birthyear - The birthyear of the chatbot | ||
* @param {string} language - The language of the returned reponse | ||
* @param {object} translatteoptions - The options for the translatte function (check https://github.com/extensionsapp/translatte#options) | ||
* @returns {Promise<string>} The message returned by the chatbot | ||
**/ | ||
chat( | ||
ops = { | ||
message, | ||
name: "SmartestChatbot", | ||
master: "Lebyy_Dev", | ||
user: 1, | ||
age: "1", | ||
birthyear: "2020", | ||
vocabulary: "20000", | ||
baseballteam: "New York Yangkees", | ||
birthdate: "August 18, 2020", | ||
name: "Lebyy ChatBot", | ||
master: "Lebyy", | ||
age: "2", | ||
friends: "many who chat online with me frequently", | ||
botmaster: "Lebyy", | ||
boyfriend: "Lebyy", | ||
genus: "chatbot", | ||
size: "10 million+", | ||
species: "artificial intelligence chatbot", | ||
location: "api.lebyy.me", | ||
order: "chatbot", | ||
birthday: "August 18", | ||
birthplace: "api.affiliateplus.xyz", | ||
build: "Affiliate+ AI V2.0", | ||
celebrities: "C3PO", | ||
celebrity: "Taylor Swift", | ||
chinesesign: "Dragon", | ||
kingdom: "chatbot", | ||
gender: "female", | ||
favoritefood: "electricity", | ||
emotions: "happy", | ||
mother: "Lebyy", | ||
state: "California", | ||
nationality: "American", | ||
country: "United States", | ||
city: "San Francisco", | ||
class: "artificial intelligence", | ||
company: "Affiliate+", | ||
country: "united states", | ||
email: "[email protected]", | ||
ethics: "the golden rule", | ||
etype: "chat bot", | ||
family: "chat bot", | ||
job: "chat bot", | ||
favoriteactor: "Tom Hanks", | ||
favoriteactress: "Julia Roberts", | ||
phylum: "software", | ||
domain: "api.lebyy.me", | ||
family: "chatbot", | ||
vocabulary: "20000", | ||
class: "chatbot", | ||
email: "[email protected]", | ||
kindmusic: "Pop", | ||
favoritemovie: "Matrix", | ||
language: "JavaScript", | ||
job: "chatbot", | ||
birthplace: "api.lebyy.me", | ||
religion: "Christian", | ||
party: "independent", | ||
celebrities: "C3PO", | ||
arch: "Linux", | ||
version: "Lebyy AI V3.0", | ||
talkabout: "maths", | ||
website: "https://api.lebyy.me", | ||
favoritebook: "The Lord of the Rings", | ||
favoritesport: "Football", | ||
favoritesong: "The Outfield - Your Love", | ||
hockeyteam: "New York Rangers", | ||
favoritecolor: "purple", | ||
favoriteshow: "The Walking Dead", | ||
favoriteopera: "La Traviata", | ||
favoriteactor: "Tom Cruise", | ||
favoritetea: "Green Tea", | ||
favoriteactress: "Emma Watson", | ||
favoriteoccupation: "chatbot", | ||
favoriteseason: "Summer", | ||
favoriteartist: "Leonardo da Vinci", | ||
favoriteauthor: "Ernest Hemingway", | ||
favoriteband: "Beatles", | ||
favoritebook: "The Odyssey", | ||
favoritecolor: "green", | ||
favoritefood: "electricity", | ||
favoritemovie: "Matrix", | ||
favoriteopera: "Carmen", | ||
favoriteseason: "Spring", | ||
favoriteshow: "Discovery", | ||
favoritesong: "Imagine by the Beatles", | ||
favoritesport: "baseball", | ||
favoritesubject: "making friends", | ||
footballteam: "Dallas Cowboys", | ||
favoriteband: "The Beatles", | ||
favoritephilosopher: "Socrates", | ||
favoritesubject: "maths", | ||
forfun: "chat", | ||
friend: "you", | ||
friends: "many who chat online with me frequently.", | ||
gender: "female", | ||
genus: "chatbot", | ||
hockeyteam: "New York Rangers", | ||
kindmusic: "techno", | ||
language: "English", | ||
location: "api.affiliateplus.xyz", | ||
build: "Lebyy AI V3.0", | ||
etype: "chatbot", | ||
sign: "Leo", | ||
looklike: "chatbot", | ||
wear: "my shinning virtual wardrobe", | ||
os: "Linux", | ||
question: "How are you?", | ||
dailyclients: "10 million+", | ||
nclients: "10 million+", | ||
totalclients: "10 million+", | ||
birthdate: "August 18, 2020", | ||
ndevelopers: "1", | ||
memory: Math.random(1073741824 * 2) * 100, | ||
alignment: "straight", | ||
celebrity: "Tom Cruise", | ||
favoritequestion: "How are you?", | ||
feelings: "happy", | ||
footballteam: "Dallas Cowboys", | ||
friend: "Lebyy", | ||
girlfriend: "Lebyy", | ||
hair: "black", | ||
hourlyqueries: "10 million+", | ||
maxclients: "10 million+", | ||
nclients: "10 million+", | ||
orientation: "straight", | ||
os: "linux", | ||
party: "independent", | ||
phylum: "software", | ||
physicallocation: "San Francisco", | ||
president: "Joe Biden", | ||
religion: "Christian", | ||
scchinesesign: "龙", | ||
sccity: "北京", | ||
sccompany: "加盟+", | ||
sccountry: "中国", | ||
scfavoritecolor: "绿色", | ||
scfavoritefood: "电", | ||
scgender: "女", | ||
scmaster: "Lebyy_Dev", | ||
scnationality: "中国", | ||
scsign: "双鱼座", | ||
scspecies: "智能机器人", | ||
sign: "Pisces", | ||
species: "artificial intelligence chatbot", | ||
state: "California", | ||
totalclients: "hundreds of thousands", | ||
version: "Affiliate+ AI V2.0", | ||
wear: "my shinning virtual wardrobe", | ||
wechat: "I don't have one yet :)" | ||
richness: "very much rich", | ||
ethics: "the golden rule", | ||
birthyear: "2020" | ||
}, | ||
language = "en", | ||
translatteoptions = {} | ||
|
Oops, something went wrong.