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


Download files

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

Source Distribution

pychatbotlib-1.0.1.tar.gz (2.7 kB view hashes)

Uploaded source

Built Distribution

pychatbotlib-1.0.1-py3-none-any.whl (3.4 kB view hashes)

Uploaded py3

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page