Skip to content
HilFing edited this page Sep 2, 2022 · 5 revisions

How to install it

Do py -m pip install ChatbotAPI and you are done.

How to use?

There are various commands and utilities in this package. To use it just do

from ChatbotAPI.chatbasics import Chatbot
bot = Chatbot(BrainId, ApiKey, BotName, history, debug)
data = bot.sendmsg("Hi")  
print(data)  
  1. To get Brain Id and other info go to BrainShop
  2. Make an account
  3. Make a brain and don't change any settings
  4. Go to the settings tab and copy the BrainID and APIkey and then use it
  5. Use boolean for history and debug switch.
  6. To turn on spellchecker use bot.spellcheck(True)
  7. Voila! It works! Now enjoy your AI chatbot.
    Thats All

Docs

bot = ChatBotAPI.chatbasics.Chatbot(string[1], string[2], string[3], boolean[1], boolean[2]) -

                 string[1] is the Brain ID  
                 string[2] is the API Key  
                 string[3] is the Bot Name  
                 boolean[1] is the history switch  
                 boolean[2] is the debug switch  

author() -

Returns the author name of this library

link() -

Returns the Github link of this library

getcreds -

Gets the bots properties in json format.

spellcheck(boolean) -

Turns the spellchecker on or off.

printlogs(string) -

Writes the logs to a file.
Filename must include extension(Recommended .txt or .log)
Default filename is Chatbot.log
Only works when debug is turned on

gethistory(int) -

Returns history in a list format
Length argument must be even and smaller than length of history.
Default length is all. Only works when history has been turned on
Recommend to use in a for loop like this

his = bot.gethistory()
for i in his:
    print(i)