cadmus

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

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

Go to latest
Published: Mar 14, 2019 License: MIT Imports: 12 Imported by: 0

README

This is a fork of https://github.com/prologic/cadmus/

Build:

docker build . -t machines/irc_bot

Run:

docker run --name irc_bot -v /tmp/irclog:/app/logs -e BOT_CHANNELS="#freenode" -e BOT_NICK=nickname -e BOT_USER=username -e BOT_REALNAME=RealName -e BOT_PASSWORD=password machines/irc_bot

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
	Password string
	Chan     []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