Skip to main content

Library for creating chatbots

Project description

PyChatbotLib


Exclusive library for creating chatbots.
It uses a very simple neural network which helps to recognize possible answers to messages.
You just need to train it in chats with 2 types of messages: reply and original.

Installation

pip install pychatbotlib

Example of usage

import telebot # pip3 install PyTelegramBotAPI==2.2.3
from time import sleep
from chatbot import Chatbot
bot = telebot.TeleBot('APIKEY')
chatbot = Chatbot("chatbot_data")

@bot.message_handler(content_types=["text"])
def handle_message(message):
    try:
        chatbot.add_data(message.text, message.reply_to_message.text)
        answer = chatbot.get_reply(message.text)
        if answer is not None:
            bot.reply_to(message, answer)
    except Exception as e:
        answer = chatbot.get_reply(message.text)
        if answer is not None:
            bot.reply_to(message, answer)
        print("Not a reply")

while True:
    try:
        bot.polling(none_stop=True)
    except Exception as e:
        bot.polling(none_stop=True)

Project details


Release history Release notifications

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for pychatbotlib, version 1.0.1
Filename, size File type Python version Upload date Hashes
Filename, size pychatbotlib-1.0.1-py3-none-any.whl (3.4 kB) File type Wheel Python version py3 Upload date Hashes View hashes
Filename, size pychatbotlib-1.0.1.tar.gz (2.7 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page