Skip to content

oiramNet/AI-IRC-Bot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

36 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

AI IRC Bot is a simple IRC bot written in Python. It was initially forked from the knrd1/chatgpt into oiramNet/ChatGPT-IRC-Bot but turned into its own project to support other AI back-ends. It connects to the selected AI endpoints to answer questions or generate images and uses official bindings from AI to interact with it using the API through the HTTP/HTTPS requests. You can find more details about supported APIs below:

Prerequisites

  1. Create an account and obtain your API KEY
  2. Install Python3 and the official bindings (pyshorteners; pytz; openai; anthropic)
    • Debian/Ubuntu
      apt install python3 python3-pip
      pip3 install pyshorteners pytz openai anthropic
      
    • RedHat/CentOS
      yum install python3 python3-pip
      pip3 install pyshorteners pytz openai anthropic
      
    • FreeBSD
      pkg install python311 py311-pip
      pip install pyshorteners pytz openai anthropic
      

Installation

Clone the package using the below command. It will copy all files into the AI-IRC-Bot directory, which you can later rename.

git clone https://github.com/oiramNet/AI-IRC-Bot

Configuration

AI IRC Bot uses a plain-text file as its configuration file. The package includes an example configuration file (AIbot.conf.sample) which is set to connect to IRCnet. You can copy and modify it to suit your preferences.

cd AI-IRC-Bot
cp AIbot.conf.sample SampleBot.conf

Some of the settings apply only to the specific AI API or models. Make sure to check the sample configuration file for details.

Supported models

AI IRC Bot can use any of the below models.

We suggest starting experimenting with gpt-4o-mini for the ChatGPT (OpenAI) or claude-3-5-haiku-latest for Claude (Anthropic).

Running bot

To start the bot, run the command below. Make sure to replace CONFIG with the name of your configuration file.

  • Debian/Ubuntu/RedHat/CentOS
    python3 AIbot.py CONFIG
    
  • FreeBSD
    python3.11 AIbot.py CONFIG
    

Interaction

AI IRC Bot is designed to process messages on standard channels (#CHANNEL) and will interact (respond) only to messages directed to it using its nickname (BOTNAME: MESSAGE).

12:34:12 < user> SampleBot: how are you?
12:34:13 < SampleBot> I'm doing well, thank you for asking! How are you today? Is there anything specific I can help you with?
12:56:21 < user> SampleBot: do you like IRC?
12:56:22 < SampleBot> I'm an AI, so I don't personally "like" or "dislike" things in the way humans do. However, I'm familiar with IRC (Internet Relay Chat) as a communication protocol. It's an older form of real-time internet chat that was very popular before modern messaging platforms. Would you like to discuss IRC or chat protocols?

If you set the model to dall-e-2 or dall-e-3 (ChatGPT/Image creation), the AI IRC Bot will return a shortened URL to the generated image.

13:14:05 < user> SampleBot: red apples on the table
13:14:35 < SampleBot> https://tinyurl.com/1a2b3c4d

Bugs, Enhancments, etc.

Feel free to contact us through the GitHub.