Skip to main content

Easy chatbot development with Python. Create your own chatbots with just a few lines of code.

Project description

BotCreator by EdexCode

Easy chatbot development with Python. Create your own chatbots with just a few lines of code.

How To Use?

Syntax

Python

import botcreator as bc

prompt = input("Prompt: ")
print(bc.botresponse(prompt.lower(), 'TXT_FILE_PATH_HERE'))

TXT File

hi#hello/Hi there!

Symbols

1. / - Separator or Divider:

Separates the expected prompt (or conditions) from the response. It divides the rule into two parts: what the bot should recognize or react to (left side) and how it should respond (right side).

Example:

hi/Hi there!

Here, 'hi' represents condition or expected input, and 'Hi there' represents response. The / separates the conditions from the responses.

2. # - OR Operator:

Indicates multiple possible responses within a single rule. When used after a response, it signifies that the bot can randomly select one of the responses listed.

Example:

hi#hello#sup/Hi there#How can I help you

Here, The # symbol in the rule hi#hello#sup/Hi there#How can I help you separates multiple alternative inputs (hi, hello, sup), indicating that the bot should respond to any of these inputs with randomly chosen responses (Hi there or How can I help you).

3. # - AND Operator:

Connects multiple conditions within the expected prompt. It indicates that all specified conditions must be present for the rule to trigger a response.

NOTE: Only works in expected prompt (or condition)

Example:

my&name&is/Nice to meet you!

Here, The & symbol in my&name&is/Nice to meet you! signifies that the bot expects all three words (my, name, is) to appear together in the user's input. When this condition is met, the bot will respond with Nice to meet you!.

4. * - STARTS WITH Operator:

The * operator triggers a response if the user's input begins with a specified substring.

NOTE: Only works in expected prompt (or condition)

Example:

*hi/hello

Here, If the user's input starts with "hi", the bot responds with "Hello".

5. ** - ENDS WITH Operator:

This operator triggers a response if the user's input ends with a specified substring defined in the configuration.

NOTE: Only works in expected prompt (or condition)

Example:

**bye/Bye!

Here, If the user's input ends with "bye", the bot responds with "Bye!".

5. regex(REGEX_HERE) - Regular Expression:

This function allows specifying complex matching conditions using regular expressions (regex) within the context of a bot or text processing system.

NOTE: Only works in expected prompt (or condition)

Example:

regex(^(?i)hi.*)/Hello

Here, if the user's input matches the pattern starting with "hi" (case insensitive), followed by any characters (.*), the bot will respond with "Hello".

Example

words.txt

my&name&is/Nice to meet you!
hi#hello#sup/Hi there#How can i help you?
are&you&a&bot#your&a&chatbot/Yes
&help/How can i help you?
*hi/Hello
**bye/Bye!
regex(^(?i)hi.*)/Hello

main.py

import botcreator as bc

prompt = input("Prompt: ")
print(bc.botresponse(prompt.lower(), 'words.txt'))

Outputs:

my&name&is/Nice to meet you!

Prompt: my name is edex
Nice to meet you!

hi/hello/sup/Hi there#How can i help you?

Prompt: hi
Hi there
Prompt: hello
How can i help you?
Prompt: sup
How can i help you?

are&you&a&bot#your&a&chatbot/Yes

Prompt: are you a bot?
Yes
Prompt: your a chatbot
Yes

&help/How can i help you?

Prompt: can you help me
How can i help you?

*hi/Hello

Prompt: hi edex
Hello

*bye/Bye!

Prompt: i gotta go bye
Bye!

regex(^(?i)hi.*)/Hello

Prompt: hi bot
Hello

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

botcreator-0.1.2b0.tar.gz (3.8 kB view details)

Uploaded Source

Built Distribution

botcreator-0.1.2b0-py3-none-any.whl (3.5 kB view details)

Uploaded Python 3

File details

Details for the file botcreator-0.1.2b0.tar.gz.

File metadata

  • Download URL: botcreator-0.1.2b0.tar.gz
  • Upload date:
  • Size: 3.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.0 CPython/3.10.14

File hashes

Hashes for botcreator-0.1.2b0.tar.gz
Algorithm Hash digest
SHA256 460c5d2a9969e379444ee1ba3fc0120b6b278ddcea500d759a031cd04a303efc
MD5 7579980ebe65f9977f658d31d81c84fc
BLAKE2b-256 82d5adbb1df7782a867e00b81d27da17feb0e4e6cdfb5fabd47b14f9d1d96113

See more details on using hashes here.

File details

Details for the file botcreator-0.1.2b0-py3-none-any.whl.

File metadata

  • Download URL: botcreator-0.1.2b0-py3-none-any.whl
  • Upload date:
  • Size: 3.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.0 CPython/3.10.14

File hashes

Hashes for botcreator-0.1.2b0-py3-none-any.whl
Algorithm Hash digest
SHA256 c3981a64bd4c5e4569bc5cab46ea66326b973cf5e55bc1dee66bfeca89e173ed
MD5 b19c8ed80f7a5417f3166ed9c8fe9543
BLAKE2b-256 5b5b5b9ad69295d18c320b7ea6c698cbeccc3acd7d1989cf62e2732c294e591b

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page