DIY-Chatbot is a Python chatbot I made back in 2018 that learns from conversations by associating user replies with previous bot messages. It uses a simple association-based algorithm and stores its knowledge in an SQLite database. The bot can be run in the terminal or as a Discord bot.
- The bot starts with no knowledge.
- You say something to the bot:
Bot: Hello User: Hi there!
- The bot stores "Hi there!" as a possible reply to "Hello".
- Next time anyone says "Hello", the bot may reply "Hi there!" based on its learned associations.
- Python 3.8+
- SQLite (bundled with Python)
-
Clone the repository:
git clone https://github.com/yourusername/DIY-Chatbot.git cd DIY-Chatbot
-
Install dependencies:
pip install -r requirements.txt
For the Discord bot, copy config.json.example
to config.json
and fill in your credentials:
{
"discordBotToken": "YOUR_DISCORD_BOT_TOKEN",
"chatbotChannelID": 123456789012345678
}
Start a chat session in your terminal:
python run.py cli
- The bot uses
data/botBrain.sqlite
by default. - To use a pre-made model, copy it to
data/botBrain.sqlite
or specify with--db-path
.
- Set up your Discord bot and get your bot token and channel ID.
- Configure your credentials as described above.
- Run the Discord bot:
python run.py discord
- Pre-trained brains are in
data/pre_made_models/
. - To use one, copy it to
data/botBrain.sqlite
or specify its path with--db-path
.
MIT License.