cadmus

package module
v0.0.0-...-ba337da Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2021 License: MIT Imports: 13 Imported by: 1

README

Cadmus - An IRC Bot, Logger of channels

From the Greek god Cadmus

In Greek mythology, Cadmus (/ˈkædməs/; Greek: Κάδμος Kadmos), was the founder and first king of Thebes. ... Cadmus was credited by the ancient Greeks (Herodotus[4] is an example) with introducing the original alphabet to the Greeks, who adapted it to form their Greek alphabet.

And so Cadmus is an IRC Bot that logs IRC Channels.

Requirements

Cadmus has no special requirements. Simply invite it to a channel you want logged and it will keep logs of the channel.

Installation

$ go get github.com/prologic/cadmus

Getting Started

Simply run cadmus:

$ ./cadmus

How it works

  • Cadmus will connect to a configured server.
  • When Cadmus is invited to a channel; it will immediately join.
  • Cadmus will then log all activity on the channel.
  • eris -- a modern IRC Server / Daemon written in Go that has a heavy focus on security and privacy
  • soter -- an IRC Bot written in Go that protects IRC Channels by persisting channel modes and topics

License

Cadmus is licensed under the MIT License.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	//PackageName package name
	Package = "cadmus"

	// Version release version
	Version = "0.1.0"

	// Build will be overwritten automatically by the build system
	Build = "dev"

	// GitCommit will be overwritten automatically by the build system
	GitCommit = "HEAD"
)

Functions

func FullVersion

func FullVersion() string

FullVersion display the full version and build

Types

type Addr

type Addr struct {
	Host   string
	Port   int
	UseTLS bool
}

func ParseAddr

func ParseAddr(s string) (addr *Addr, err error)

func (*Addr) String

func (a *Addr) String() string

type Bot

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

func NewBot

func NewBot(addr string, config *Config) *Bot

func (*Bot) Run

func (b *Bot) Run() error

type Channel

type Channel struct {
	ID        int       `storm:"id,increment"`
	Name      string    `storm:"index"`
	CreatedAt time.Time `storm:"index"`
}

func NewChannel

func NewChannel(name string) Channel

type ChannelLoggerMap

type ChannelLoggerMap struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

ChannelLoggerMap holds a mapping of channels to Logger interfaces that is safe for concurrent readers and writers.

func NewChannelLoggerMap

func NewChannelLoggerMap() *ChannelLoggerMap

NewChannelLoggerMap returns a new initialized *ChannelLoggerMap

func (*ChannelLoggerMap) Add

func (c *ChannelLoggerMap) Add(logger Logger) error

Add adds a new *Channel if not already exists or an error otherwise

func (*ChannelLoggerMap) Count

func (c *ChannelLoggerMap) Count() int

Count returns the number of Logger(s)

func (*ChannelLoggerMap) Get

func (c *ChannelLoggerMap) Get(channel string) Logger

Get returns a Logger given a channel if it exists or a zero-value Logger

func (*ChannelLoggerMap) Range

func (c *ChannelLoggerMap) Range(f func(kay string, value Logger) bool)

Range ranges over the Logger(s) calling f

type Config

type Config struct {
	Nick string
	User string
	Name string

	Debug   bool
	DBPath  string
	LogPath string
}

type FileLogger

type FileLogger struct {
	sync.Mutex
	// contains filtered or unexported fields
}

func NewFileLogger

func NewFileLogger(logdir, network, channel string) (*FileLogger, error)

func (*FileLogger) Channel

func (l *FileLogger) Channel() string

func (*FileLogger) Log

func (l *FileLogger) Log(message string) error

func (*FileLogger) LogMessage

func (l *FileLogger) LogMessage(user, message string) error

func (*FileLogger) Logf

func (l *FileLogger) Logf(format string, args ...interface{}) error

func (*FileLogger) Network

func (l *FileLogger) Network() string

func (*FileLogger) Rotate

func (l *FileLogger) Rotate() error

type Logger

type Logger interface {
	Rotate() error
	Log(message string) error
	Logf(format string, args ...interface{}) error

	Channel() string
	Network() string

	LogMessage(user, message string) error
}

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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