Skip to content

A small-scale neural networks chatbot in Python linked to Discord!

License

Notifications You must be signed in to change notification settings

Okaneeee/discord-chatbot

Repository files navigation

🤖 Discord Chatbot

A simple chatbot for Discord using Python and the Discord.py library.
The chatbot is using the NeuralIntents library for neural networks and training. It is a small-scale neural network with a small dataset.*
The chatbot is also using the Urban Dictionary API to search for some information on the internet.*

*It's not always accurate, it's made for personal and educational purposes. Use it at your own risk.

Table of Content

Click me!

Getting Started

Installation

Instructions for cloning with git
  • Open a terminal and navigate to the directory where you want to clone the repo.
  • Run the following commands:
git clone https://github.com/Okaneeee/discord-chatbot.git
cd discord-chatbot

Instructions for downloading the zip
  • Click on the green Code button and select Download ZIP. Or click here
  • Extract the zip file to the directory where you want to clone the repo.
  • Open a terminal in the folder where you extracted the zip file and run the following command:
cd discord-chatbot

This repo was made with Python 3.11.7. You can check the working versions of Python for this repo here.

The repo uses some dependencies. You can install them by running the following command:

pip install -r requirements.txt

Quick Start

You'll need to setup a .env file first. The .env need to be on the same folder as the repo. You can use the following template, or you can rename the .env.example file to .env.

TOKEN =
GUILD = 
OWNID = 

TOKEN is the bot token you get from the Discord Developer Portal.
More information here.

GUILD is the server ID you want the bot be active on. You can remove this field but you'll need to remove it on the main.py file too.
More information on how to get your server ID here.

OWNID is the bot's ID. It is used as a prefix for the bot (when you're mentioning (@) it). You can remove this field but you'll also need to remove it on the main.py file and set a new prefix.
More information on how to get the bot ID here.

After, you'll need to add your bot to your server.
Finally, you can run the bot by running the following command:

python src/main.py

Project Status

Dependencies:

Version Done Status
Python 3.7 Too old
Python 3.8 Python 3.8
Python 3.9 Python 3.9
Python 3.10 Python 3.8
Python 3.11 Python 3.8
Python 3.12 Python 3.8

Code quality:

Actions Done Status
Spelling Spelling
CodeQL CodeQL

Features

  • Slash commands
  • A small-scale chatbot that can answer some question*
  • Can search for some information on the internet using the Urban Dictionary API*

*The chatbot is still in development and it's not perfect. It's using a small dataset and it's not trained to answer all questions. It's also not able to understand the context of the conversation. It's a simple chatbot that can answer some questions and search for some information on the internet. The search part is not optimized and is not working everytime.

Examples:

⚜️ Slash commands

Example

Slash commands

🤖 Chatbot

Example

Chatbot

🔎 Searching

Examples

Searching 1 Searching 2

Contributing

You are welcome to contribute by following the instructions in the CONTRIBUTING file and adhering to the Code of Conduct.

Inspiration and sources

This project was inspired by the NeuralNine's video on how to create a chatbot using Python and Deep Learning.
You can also look at tatiblockchain's python deep learning chatbot for a similar project using Flask.
Some part are written with the help of GitHub Copilot.

Copyrights

This project is licensed under the MIT License - see the LICENSE file for details.
This include all contributions to the project, even from the community.

Copyright © 2024 Okane