Skip to content

RafiBG/AIChatDiscordBot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Description

Made with C# on .NET 9.0 and libraries: DSharpPlus, DsharpPlus.Interactivity, DSharpPlus.SlashCommands, Newtonsoft.Json

How to use it

Go to Discord developer portal link: https://discord.com/developers/applications. Make your own discord bot and get the token that will be used in configOllama. Before you leave the website go to Bot and turn on the ones that you see on the image. privilage

Now the Bot Permissions are shown in the image that you must check to work. bot

GPT4ALL Nomic AI or Ollama (user choice)

GPT4ALL Nomic AI

Install GPT4ALL from this link: https://www.nomic.ai/gpt4all When you open the program in the left go to Models and download the model you like. Go to Settings -> Application -> Advanced and Enable Local API Server and check what is your API port number (the number can be changed) Here is a image of what you are looking for and how it shoud be. gpt4allAdvanced In Settings -> Model find Model File and write the exact same name that is written there in the configGPT4All colum model. Local host number that you have in your API port number.

GPT4ALL must be running to be able to connect to your local AI chat bot for discord.

For first time running you must open AIChatDiscordBot.sln . You will need Visual Studio to open it. Download link for Visual Studio : https://visualstudio.microsoft.com/thank-you-downloading-visual-studio/?sku=Community&channel=Release&version=VS2022&source=VSLandingPage&passive=false&cid=2030

When you open it in Visual Studio, press AIChatDiscordBot up there. Here is an image of what you will be looking at. start vis You can now close the console and Visual Studio.

In the folder Config there is configGPT4All add your Discord token, the 4 numbers of your server, the exact name of the model that you downloaded, then copy the whole file configGPT4All and go to AIChatDiscordBot\AIChatDiscordBot\bin\Debug\net9.0 and paste it there, also there is your AIChatDiscordBot.exe to start the program.

Ollama

Install Ollama from this link: https://ollama.com/ From the official ollama website you can download AI model for your discord bot: https://ollama.com/search Open your console and enter: ollama serve It will show you the error and the last 5 numbers that you need to put in configOllama to connect the AI. comm

Ollama must be running in the background to be able to connect to your local AI chat bot for discord. Run the command in the console: ollama list Copy the full name of the model you downloaded. We will need it for configOllama Example of what you will be looking for the name of the model in the console. ModelName

For first time running you must open AIChatDiscordBot.sln . You will need Visual Studio to open it. Download link for Visual Studio : https://visualstudio.microsoft.com/thank-you-downloading-visual-studio/?sku=Community&channel=Release&version=VS2022&source=VSLandingPage&passive=false&cid=2030

When you open it in Visual Studio, press AIChatDiscordBot up there. Here is an image of what you will be looking at. start vis You can now close the console and Visual Studio.

In the folder Config there is configOllama add your Discord token, the 5 numbers of your server, the exact name of the model that you downloaded, then copy the whole file configOllama and go to AIChatDiscordBot\AIChatDiscordBot\bin\Debug\net9.0 and paste it there, also there is your AIChatDiscordBot.exe to start the program.

If you get in the console this error: "No connection could be made because the target machine actively refused it." Check if your "localhost" number is correct and token for configOllama server or create one.

Slash commands

/ask (your message)
/forgetme - Start a fresh conversation with the AI only for you.
/reset - Resets all the user's chats and starts a whole new conversation for everyone.
/help - Show all the commands for the AI chat bot.

Results

ask0

AI response

About

Locally running AI chat bot for Discord server. Made with libraries from DSharpPlus.

Topics

Resources

License

Stars

Watchers

Forks

Languages