this is a log website
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

3.6 KiB

title : IRC todo author: zvevqx published: 2025-11-22 cat: wip desc: ws

...

the selection

installed
ircd-hybrid https://github.com/ircd-hybrid/ircd-hybrid
light and easy to setup , the one most of irc rpi server seems to use / No logging by default
installed
inspirc https://www.inspircd.org/
modular , to compile from source , huge documentation , logging by default
UnrealIrc https://www.unrealircd.org/docs/About_UnrealIRCd

currently the most widely deployed IRC Server with a market share of 38% according to IRCStats.org.

Logging solution

  • inspirc do really it by default
  • using a logBot from the internet
  • building one
  • using irssi irc client on the server side with logging enable in a screen or tmux session

Review logs

  • simple raw txt files
  • using a irc logging system

stuff of interest

irc client in flask https://github.com/linxlunx/flask-irc

chat gpt cheat for creating a bot

untested

Creating an IRC bot to log a channel in Python involves several steps, including connecting to an IRC server, joining a channel, and logging messages. You'll also need to use an IRC library to simplify the process. In this example, we'll use the irc library, which you can install via pip:

pip install irc

Here's a simple Python code example for creating an IRC bot to log a channel:

import irc.client
import datetime

# Define the IRC bot class
class IRCBot(irc.client.SimpleIRCClient):
    def __init__(self, channel, log_file):
        super().__init__()
        self.channel = channel
        self.log_file = log_file

    def on_welcome(self, connection, event):
        connection.join(self.channel)

    def on_pubmsg(self, connection, event):
        channel = event.target
        message = event.arguments[0]
        timestamp = datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S')
        
        # Log the message to the file
        with open(self.log_file, 'a') as log:
            log.write(f'[{timestamp}] <{event.source.nick}> {message}\n')

# Configuration
server = 'irc.example.com'  # Replace with your IRC server
channel = '#example-channel'  # Replace with the channel you want to log
log_file = 'irc_log.txt'  # Specify the log file name

# Create and connect the IRC bot
client = irc.client.IRC()
bot = IRCBot(channel, log_file)
connection = client.server().connect(server, 6667, 'bot_nick')

# Start the bot
client.process_forever()

In this code:

  1. We define the IRCBot class that inherits from irc.client.SimpleIRCClient. This class handles events like connecting to the server, joining the channel, and logging messages.

  2. In the on_welcome method, we join the specified channel once the bot successfully connects to the IRC server.

  3. The on_pubmsg method logs messages to the specified log file, including the message content, sender's nickname, and a timestamp.

  4. In the configuration section, you need to replace server, channel, and log_file with your IRC server details and the channel you want to log.

  5. We create an IRC client, instantiate the IRCBot class, and establish a connection to the server.

  6. Finally, we start the IRC client's event loop with client.process_forever() to keep the bot running and handling IRC events.

Make sure to replace the placeholders in the code with your specific IRC server, channel, and log file information. Additionally, consider adding error handling and additional features as needed for your specific use case.