irc

package
v0.6.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 3, 2026 License: MIT Imports: 10 Imported by: 1

Documentation

Overview

Package irc provides an IRC provider for omnichat.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	// Server is the IRC server address (e.g., "irc.libera.chat:6697").
	Server string

	// Nick is the bot's nickname.
	Nick string

	// User is the username (defaults to Nick if empty).
	User string

	// RealName is the real name field (defaults to Nick if empty).
	RealName string

	// Password is the NickServ password (optional).
	Password string

	// Channels is the list of channels to join on connect.
	Channels []string

	// UseTLS enables TLS for the connection.
	UseTLS bool

	// Logger is the logger instance.
	Logger *slog.Logger
}

Config configures the IRC provider.

type Provider

type Provider struct {
	// contains filtered or unexported fields
}

Provider implements the Provider interface for IRC.

func New

func New(config Config) (*Provider, error)

New creates a new IRC provider.

func (*Provider) Connect

func (p *Provider) Connect(ctx context.Context) error

Connect establishes connection to the IRC server.

func (*Provider) Disconnect

func (p *Provider) Disconnect(ctx context.Context) error

Disconnect closes the IRC connection.

func (*Provider) IsConnected

func (p *Provider) IsConnected() bool

IsConnected returns whether the provider is connected.

func (*Provider) JoinChannel

func (p *Provider) JoinChannel(channel string) error

JoinChannel joins an IRC channel.

func (*Provider) Name

func (p *Provider) Name() string

Name returns the provider name.

func (*Provider) OnEvent

func (p *Provider) OnEvent(handler provider.EventHandler)

OnEvent registers an event handler.

func (*Provider) OnMessage

func (p *Provider) OnMessage(handler provider.MessageHandler)

OnMessage registers a message handler.

func (*Provider) PartChannel

func (p *Provider) PartChannel(channel string, reason string) error

PartChannel leaves an IRC channel.

func (*Provider) Send

func (p *Provider) Send(ctx context.Context, chatID string, msg provider.OutgoingMessage) error

Send sends a message to an IRC channel or user.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL