Skip to content

Commit 0f6751e

Browse files
authored
Merge pull request #18 from Lebyy/develop
🎉 | Release 3.0.0
2 parents 93d1d50 + 2e740c7 commit 0f6751e

File tree

4 files changed

+341
-282
lines changed

4 files changed

+341
-282
lines changed

README.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,19 @@ This package is just for Entertainment Purpose.
1313
### 📝 [Example Discord Bot](https://github.com/Lebyy/SmartestChatBot-Example)
1414
#
1515

16+
#
17+
## ❓ How to obtain an API Token?
18+
> **You can visit [api.lebyy.me/dashboard](https://api.lebyy.me/dashboard) to obtain an API Token.**
19+
#
20+
1621
# Quick Example
1722

1823
**Javascript:**
1924
```js
2025
// Importing The Package
2126
const smartestchatbot = require('smartestchatbot');
2227

23-
const client = new smartestchatbot.Client();
28+
const client = new smartestchatbot.Client("API_TOKEN");
2429

2530
client.chat({message:"Hello, How are you?", name:"SmartestChatbot", owner:"CoolOwnerName", user: CoolUniqueUserId-In-NumberType}, "CoolLanguage").then(reply => {
2631
console.log(reply);

index.js

Lines changed: 175 additions & 142 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
const base = "https://api.affiliateplus.xyz/api";
1+
const base = "https://api.lebyy.me/api";
22
const translatte = require("translatte");
33
const superagent = require("superagent");
44
/**
@@ -7,9 +7,17 @@ const superagent = require("superagent");
77
* @class Client
88
*/
99
class Client {
10-
constructor() {
10+
constructor(token) {
11+
if (!token) throw new Error("No token provided!");
12+
1113
/**
12-
* The function to fetch respone from the Affiliate+ API
14+
* The token of the API
15+
* @type {string}
16+
*/
17+
this.token = token;
18+
19+
/**
20+
* The function to fetch respone from the Lebyy API
1321
* @type {Function}
1422
* @ignore
1523
* @private
@@ -21,6 +29,7 @@ class Client {
2129
(
2230
await superagent
2331
.get(`${base}/chatbot?${new URLSearchParams(ops).toString()}`)
32+
.set("Authorization", this.token)
2433
.type("json")
2534
.accept("json")
2635
).body.message
@@ -35,6 +44,7 @@ class Client {
3544
const englishResponse = (
3645
await superagent
3746
.get(`${base}/chatbot?${new URLSearchParams(ops).toString()}`)
47+
.set("Authorization", this.token)
3848
.type("json")
3949
.accept("json")
4050
).body.message;
@@ -53,163 +63,186 @@ class Client {
5363
/**
5464
* @param {object} ops - The options
5565
* @param {string} ops.message - The message
56-
* @param {string} ops.name - The name of the bot
57-
* @param {string} ops.master - The master of the bot
5866
* @param {string | number | bigint} ops.user - The user id
59-
* @param {string} ops.language - The language of the returned reponse
60-
* @param {string} ops.age - The age of the bot.
61-
* @param {string} ops.birthyear - The birth year of the bot.
62-
* @param {string} ops.vocabulary - The vocabulary count of the bot.
63-
* @param {string} ops.baseballteam - The baseball team of the bot.
64-
* @param {string} ops.birthdate - The birth date of the bot.
65-
* @param {string} ops.birthday - The birthday of the bot.
66-
* @param {string} ops.birthplace - The birthplace of the bot.
67-
* @param {string} ops.build - The build version of the bot.
68-
* @param {string} ops.celebrities - The celebrities of the bot.
69-
* @param {string} ops.chinesesign - The chinese sign of the bot.
70-
* @param {string} ops.city - The city of the bot.
71-
* @param {string} ops.class - The class of the bot.
72-
* @param {string} ops.company - The company of the bot.
73-
* @param {string} ops.country - The country of the bot.
74-
* @param {string} ops.email - The email of the bot.
75-
* @param {string} ops.ethics - The ethics of the bot.
76-
* @param {string} ops.etype - The etype of the bot.
77-
* @param {string} ops.family - The family of the bot.
78-
* @param {string} ops.job - The job of the bot.
79-
* @param {string} ops.favoriteactor - The favorite actor of the bot.
80-
* @param {string} ops.favoriteactress - The favorite actress of the bot.
81-
* @param {string} ops.favoriteartist - The favorite artist of the bot.
82-
* @param {string} ops.favoriteauthor - The favorite author of the bot.
83-
* @param {string} ops.favoriteband - The favorite band of the bot.
84-
* @param {string} ops.favoritebook - The favorite book of the bot.
85-
* @param {string} ops.favoritecolor - The favorite color of the bot.
86-
* @param {string} ops.favoritefood - The favorite food of the bot.
87-
* @param {string} ops.favoritemovie - The favorite movie of the bot.
88-
* @param {string} ops.favoriteopera - The favorite opera of the bot.
89-
* @param {string} ops.favoriteseason - The favorite season of the bot.
90-
* @param {string} ops.favoriteshow - The favorite show of the bot.
91-
* @param {string} ops.favoritesong - The favorite song of the bot.
92-
* @param {string} ops.favoritesport - The favorite sport of the bot.
93-
* @param {string} ops.favoritesubject - The favorite subject of the bot.
94-
* @param {string} ops.footballteam - The football team of the bot.
95-
* @param {string} ops.forfun - The forfun activity of the bot.
96-
* @param {string} ops.friend - The friend of the bot.
97-
* @param {string} ops.friends - The friends of the bot.
98-
* @param {string} ops.gender - The gender of the bot.
99-
* @param {string} ops.genus - The genus of the bot.
100-
* @param {string} ops.hockeyteam - The hockeyteam of the bot.
101-
* @param {string} ops.kindmusic - The kindmusic of the bot.
102-
* @param {string} ops.language - The language of the bot.
103-
* @param {string} ops.location - The location of the bot.
104-
* @param {string} ops.ndevelopers - The ndevelopers of the bot.
105-
* @param {string} ops.nclients - The nclients of the bot.
106-
* @param {string} ops.orientation - The orientation of the bot.
107-
* @param {string} ops.os - The os of the bot.
108-
* @param {string} ops.party - The party of the bot.
109-
* @param {string} ops.phylum - The phylum of the bot.
110-
* @param {string} ops.physicallocation - The physicallocation of the bot.
111-
* @param {string} ops.president - The president of the bot.
112-
* @param {string} ops.religion - The religion of the bot.
113-
* @param {string} ops.scchinesesign - The scchinesesign of the bot.
114-
* @param {string} ops.sccity - The sccity of the bot.
115-
* @param {string} ops.sccompany - The sccompany of the bot.
116-
* @param {string} ops.sccountry - The sccountry of the bot.
117-
* @param {string} ops.scfavoritecolor - The scfavoritecolor of the bot.
118-
* @param {string} ops.scfavoritefood - The scfavoritefood of the bot.
119-
* @param {string} ops.scgender - The scgender of the bot.
120-
* @param {string} ops.scmaster - The scmaster of the bot.
121-
* @param {string} ops.scnationality - The scnationality of the bot.
122-
* @param {string} ops.scsign - The scsign of the bot.
123-
* @param {string} ops.scspecies - The scspecies of the bot.
124-
* @param {string} ops.sign - The sign of the bot.
125-
* @param {string} ops.species - The species of the bot.
126-
* @param {string} ops.state - The state of the bot.
127-
* @param {string} ops.totalclients - The totalclients of the bot.
128-
* @param {string} ops.version - The version of the bot.
129-
* @param {string} ops.wear - The wear of the bot.
130-
* @param {string} ops.wechat - The wechat of the bot.
67+
* @param {string} ops.name - The name of the chatbot
68+
* @param {string} ops.master - The master of the chatbot
69+
* @param {string} ops.age - The age of the chatbot
70+
* @param {string} ops.friends - The friends of the chatbot
71+
* @param {string} ops.botmaster - The botmaster of the chatbot
72+
* @param {string} ops.boyfriend - The boyfriend of the chatbot
73+
* @param {string} ops.genus - The genus of the chatbot
74+
* @param {string} ops.size - The size of the chatbot
75+
* @param {string} ops.species - The species of the chatbot
76+
* @param {string} ops.location - The location of the chatbot
77+
* @param {string} ops.order - The order of the chatbot
78+
* @param {string} ops.birthday - The birthday of the chatbot
79+
* @param {string} ops.kingdom - The kingdom of the chatbot
80+
* @param {string} ops.gender - The gender of the chatbot
81+
* @param {string} ops.favoritefood - The favoritefood of the chatbot
82+
* @param {string} ops.emotions - The emotions of the chatbot
83+
* @param {string} ops.mother - The mother of the chatbot
84+
* @param {string} ops.state - The state of the chatbot
85+
* @param {string} ops.nationality - The nationality of the chatbot
86+
* @param {string} ops.country - The country of the chatbot
87+
* @param {string} ops.city - The city of the chatbot
88+
* @param {string} ops.phylum - The phylum of the chatbot
89+
* @param {string} ops.domain - The domain of the chatbot
90+
* @param {string} ops.family - The family of the chatbot
91+
* @param {string} ops.vocabulary - The vocabulary of the chatbot
92+
* @param {string} ops.class - The class of the chatbot
93+
* @param {string} ops.email - The email of the chatbot
94+
* @param {string} ops.kindmusic - The kindmusic of the chatbot
95+
* @param {string} ops.favoritemovie - The favoritemovie of the chatbot
96+
* @param {string} ops.language - The language spoken by chatbot
97+
* @param {string} ops.job - The job of the chatbot
98+
* @param {string} ops.birthplace - The birthplace of the chatbot
99+
* @param {string} ops.religion - The religion of the chatbot
100+
* @param {string} ops.party - The party of the chatbot
101+
* @param {string} ops.celebrities - The celebrities of the chatbot
102+
* @param {string} ops.arch - The arch of the chatbot
103+
* @param {string} ops.version - The version of the chatbot
104+
* @param {string} ops.talkabout - The talkabout topic of the chatbot
105+
* @param {string} ops.website - The website of the chatbot
106+
* @param {string} ops.favoritebook - The favoritebook of the chatbot
107+
* @param {string} ops.favoritesport - The favoritesport of the chatbot
108+
* @param {string} ops.favoritesong - The favoritesong of the chatbot
109+
* @param {string} ops.hockeyteam - The hockeyteam of the chatbot
110+
* @param {string} ops.favoritecolor - The favoritecolor of the chatbot
111+
* @param {string} ops.favoriteshow - The favoriteshow of the chatbot
112+
* @param {string} ops.favoriteopera - The favoriteopera of the chatbot
113+
* @param {string} ops.favoriteactor - The favoriteactor of the chatbot
114+
* @param {string} ops.favoritetea - The favoritetea of the chatbot
115+
* @param {string} ops.favoriteactress - The favoriteactress of the chatbot
116+
* @param {string} ops.favoriteoccupation - The favoriteoccupation of the chatbot
117+
* @param {string} ops.favoriteseason - The favoriteseason of the chatbot
118+
* @param {string} ops.favoriteartist - The favoriteartist of the chatbot
119+
* @param {string} ops.favoriteauthor - The favoriteauthor of the chatbot
120+
* @param {string} ops.favoriteband - The favoriteband of the chatbot
121+
* @param {string} ops.favoritephilosopher - The favoritephilosopher of the chatbot
122+
* @param {string} ops.favoritesubject - The favoritesubject of the chatbot
123+
* @param {string} ops.forfun - The forfun activity of the chatbot
124+
* @param {string} ops.build - The build of the chatbot
125+
* @param {string} ops.etype - The etype of the chatbot
126+
* @param {string} ops.sign - The sign of the chatbot
127+
* @param {string} ops.looklike - The looklike of the chatbot
128+
* @param {string} ops.wear - The wear of the chatbot
129+
* @param {string} ops.os - The os of the chatbot
130+
* @param {string} ops.question - The question of the chatbot
131+
* @param {string} ops.dailyclients - The dailyclients of the chatbot
132+
* @param {string} ops.nclients - The nclients of the chatbot
133+
* @param {string} ops.totalclients - The totalclients of the chatbot
134+
* @param {string} ops.birthdate - The birthdate of the chatbot
135+
* @param {string} ops.ndevelopers - The ndevelopers of the chatbot
136+
* @param {number} ops.memory - The memory of the chatbot
137+
* @param {string} ops.alignment - The alignment of the chatbot
138+
* @param {string} ops.celebrity - The celebrity of the chatbot
139+
* @param {string} ops.favoritequestion - The favoritequestion of the chatbot
140+
* @param {string} ops.feelings - The feelings of the chatbot
141+
* @param {string} ops.footballteam - The footballteam of the chatbot
142+
* @param {string} ops.friend - The friend of the chatbot
143+
* @param {string} ops.girlfriend - The girlfriend of the chatbot
144+
* @param {string} ops.hair - The hair of the chatbot
145+
* @param {string} ops.hourlyqueries - The hourlyqueries of the chatbot
146+
* @param {string} ops.maxclients - The maxclients of the chatbot
147+
* @param {string} ops.orientation - The orientation of the chatbot
148+
* @param {string} ops.president - The president of the chatbot
149+
* @param {string} ops.richness - The richness of the chatbot
150+
* @param {string} ops.ethics - The ethics of the chatbot
151+
* @param {string} ops.birthyear - The birthyear of the chatbot
131152
* @param {string} language - The language of the returned reponse
132153
* @param {object} translatteoptions - The options for the translatte function (check https://github.com/extensionsapp/translatte#options)
133154
* @returns {Promise<string>} The message returned by the chatbot
134155
**/
135156
chat(
136157
ops = {
137158
message,
138-
name: "SmartestChatbot",
139-
master: "Lebyy_Dev",
140159
user: 1,
141-
age: "1",
142-
birthyear: "2020",
143-
vocabulary: "20000",
144-
baseballteam: "New York Yangkees",
145-
birthdate: "August 18, 2020",
160+
name: "Lebyy ChatBot",
161+
master: "Lebyy",
162+
age: "2",
163+
friends: "many who chat online with me frequently",
164+
botmaster: "Lebyy",
165+
boyfriend: "Lebyy",
166+
genus: "chatbot",
167+
size: "10 million+",
168+
species: "artificial intelligence chatbot",
169+
location: "api.lebyy.me",
170+
order: "chatbot",
146171
birthday: "August 18",
147-
birthplace: "api.affiliateplus.xyz",
148-
build: "Affiliate+ AI V2.0",
149-
celebrities: "C3PO",
150-
celebrity: "Taylor Swift",
151-
chinesesign: "Dragon",
172+
kingdom: "chatbot",
173+
gender: "female",
174+
favoritefood: "electricity",
175+
emotions: "happy",
176+
mother: "Lebyy",
177+
state: "California",
178+
nationality: "American",
179+
country: "United States",
152180
city: "San Francisco",
153-
class: "artificial intelligence",
154-
company: "Affiliate+",
155-
country: "united states",
156-
157-
ethics: "the golden rule",
158-
etype: "chat bot",
159-
family: "chat bot",
160-
job: "chat bot",
161-
favoriteactor: "Tom Hanks",
162-
favoriteactress: "Julia Roberts",
181+
phylum: "software",
182+
domain: "api.lebyy.me",
183+
family: "chatbot",
184+
vocabulary: "20000",
185+
class: "chatbot",
186+
187+
kindmusic: "Pop",
188+
favoritemovie: "Matrix",
189+
language: "JavaScript",
190+
job: "chatbot",
191+
birthplace: "api.lebyy.me",
192+
religion: "Christian",
193+
party: "independent",
194+
celebrities: "C3PO",
195+
arch: "Linux",
196+
version: "Lebyy AI V3.0",
197+
talkabout: "maths",
198+
website: "https://api.lebyy.me",
199+
favoritebook: "The Lord of the Rings",
200+
favoritesport: "Football",
201+
favoritesong: "The Outfield - Your Love",
202+
hockeyteam: "New York Rangers",
203+
favoritecolor: "purple",
204+
favoriteshow: "The Walking Dead",
205+
favoriteopera: "La Traviata",
206+
favoriteactor: "Tom Cruise",
207+
favoritetea: "Green Tea",
208+
favoriteactress: "Emma Watson",
209+
favoriteoccupation: "chatbot",
210+
favoriteseason: "Summer",
163211
favoriteartist: "Leonardo da Vinci",
164212
favoriteauthor: "Ernest Hemingway",
165-
favoriteband: "Beatles",
166-
favoritebook: "The Odyssey",
167-
favoritecolor: "green",
168-
favoritefood: "electricity",
169-
favoritemovie: "Matrix",
170-
favoriteopera: "Carmen",
171-
favoriteseason: "Spring",
172-
favoriteshow: "Discovery",
173-
favoritesong: "Imagine by the Beatles",
174-
favoritesport: "baseball",
175-
favoritesubject: "making friends",
176-
footballteam: "Dallas Cowboys",
213+
favoriteband: "The Beatles",
214+
favoritephilosopher: "Socrates",
215+
favoritesubject: "maths",
177216
forfun: "chat",
178-
friend: "you",
179-
friends: "many who chat online with me frequently.",
180-
gender: "female",
181-
genus: "chatbot",
182-
hockeyteam: "New York Rangers",
183-
kindmusic: "techno",
184-
language: "English",
185-
location: "api.affiliateplus.xyz",
217+
build: "Lebyy AI V3.0",
218+
etype: "chatbot",
219+
sign: "Leo",
220+
looklike: "chatbot",
221+
wear: "my shinning virtual wardrobe",
222+
os: "Linux",
223+
question: "How are you?",
224+
dailyclients: "10 million+",
225+
nclients: "10 million+",
226+
totalclients: "10 million+",
227+
birthdate: "August 18, 2020",
186228
ndevelopers: "1",
229+
memory: Math.random(1073741824 * 2) * 100,
230+
alignment: "straight",
231+
celebrity: "Tom Cruise",
232+
favoritequestion: "How are you?",
233+
feelings: "happy",
234+
footballteam: "Dallas Cowboys",
235+
friend: "Lebyy",
236+
girlfriend: "Lebyy",
237+
hair: "black",
238+
hourlyqueries: "10 million+",
239+
maxclients: "10 million+",
187240
nclients: "10 million+",
188241
orientation: "straight",
189-
os: "linux",
190-
party: "independent",
191-
phylum: "software",
192-
physicallocation: "San Francisco",
193242
president: "Joe Biden",
194-
religion: "Christian",
195-
scchinesesign: "龙",
196-
sccity: "北京",
197-
sccompany: "加盟+",
198-
sccountry: "中国",
199-
scfavoritecolor: "绿色",
200-
scfavoritefood: "电",
201-
scgender: "女",
202-
scmaster: "Lebyy_Dev",
203-
scnationality: "中国",
204-
scsign: "双鱼座",
205-
scspecies: "智能机器人",
206-
sign: "Pisces",
207-
species: "artificial intelligence chatbot",
208-
state: "California",
209-
totalclients: "hundreds of thousands",
210-
version: "Affiliate+ AI V2.0",
211-
wear: "my shinning virtual wardrobe",
212-
wechat: "I don't have one yet :)"
243+
richness: "very much rich",
244+
ethics: "the golden rule",
245+
birthyear: "2020"
213246
},
214247
language = "en",
215248
translatteoptions = {}

0 commit comments

Comments
 (0)