dumbirc

package module
v1.2.11 Latest Latest
Warning

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

Go to latest
Published: Jan 13, 2019 License: MIT Imports: 10 Imported by: 1

README

dumbirc

Donate GoDoc

experimenting with sorcix irc library

Documentation

Index

Constants

View Source
const (
	PRIVMSG   = irc.PRIVMSG
	PING      = irc.PING
	PONG      = irc.PONG
	WELCOME   = irc.RPL_WELCOME
	NICKTAKEN = irc.ERR_NICKNAMEINUSE
	JOIN      = irc.JOIN
	KICK      = irc.KICK
	NOTICE    = irc.NOTICE
	//Useful if you wanna check for activity
	ANYMESSAGE = "ANY"
)

Map event codes

Variables

This section is empty.

Functions

func Destroy added in v1.1.0

func Destroy(c *Connection)

Destroy terminates monitor goroutines created by New()

Types

type Connection

type Connection struct {
	Nick        string
	User        string
	RealN       string
	Server      string
	TLS         bool
	Password    string
	Throttle    time.Duration
	ConnTimeout time.Duration
	//Fake Connected status
	DebugFakeConn bool

	Log     *log.Logger
	Debug   *log.Logger
	Errchan chan error
	Send    chan string

	sync.WaitGroup
	// contains filtered or unexported fields
}

Connection Settings

func New

func New(nick, user, server string, tls bool) *Connection

New creates a new irc object

func (*Connection) Action

func (c *Connection) Action(dest, msg string)

Action sends an action to 'dest' (user or channel)

func (*Connection) AddCallback

func (c *Connection) AddCallback(event string, callback func(*Message))

AddCallback Adds callback to an event

func (*Connection) AddTrigger

func (c *Connection) AddTrigger(t Trigger)

AddTrigger adds triggers

func (*Connection) ChMode

func (c *Connection) ChMode(user, channel, mode string)

ChMode is used to change users modes in a channel operator = "+o" deop = "-o" ban = "+b"

func (*Connection) Cmd

func (c *Connection) Cmd(command string)

Cmd sends command

func (*Connection) Disconnect

func (c *Connection) Disconnect()

Disconnect disconnects from irc

func (*Connection) HandleJoin

func (c *Connection) HandleJoin(chans []string)

HandleJoin joins channels on welcome

func (*Connection) HandleNickTaken

func (c *Connection) HandleNickTaken()

HandleNickTaken changes nick when nick taken

func (*Connection) HandlePingPong

func (c *Connection) HandlePingPong()

HandlePingPong replies to and sends pings

func (*Connection) IsConnected

func (c *Connection) IsConnected() bool

IsConnected returns connection status

func (*Connection) Join

func (c *Connection) Join(channels []string)

Join channels

func (*Connection) LogNotices

func (c *Connection) LogNotices()

LogNotices logs notice messages

func (*Connection) Msg

func (c *Connection) Msg(dest, msg string)

Msg sends privmessage

func (*Connection) MsgBulk

func (c *Connection) MsgBulk(dest []string, msg string)

MsgBulk sends message to many

func (*Connection) NewNick

func (c *Connection) NewNick(nick string)

NewNick Changes nick

func (*Connection) Notice

func (c *Connection) Notice(dest, msg string)

Notice sends a NOTICE message to 'dest' (user or channel)

func (*Connection) Ping

func (c *Connection) Ping()

Ping sends ping

func (*Connection) Pong

func (c *Connection) Pong()

Pong sends pong

func (*Connection) Reply

func (c *Connection) Reply(m *Message, reply string)

Reply replies to a message

func (*Connection) RunCallbacks

func (c *Connection) RunCallbacks(m *Message)

RunCallbacks ...

func (*Connection) RunTriggers

func (c *Connection) RunTriggers(m *Message)

RunTriggers ...

func (*Connection) SetDebugOutput

func (c *Connection) SetDebugOutput(w io.Writer)

SetDebugOutput sets debug logger writer

func (*Connection) SetLogOutput

func (c *Connection) SetLogOutput(w io.Writer)

SetLogOutput sets logger writer

func (*Connection) SetPassword

func (c *Connection) SetPassword(pass string)

SetPassword sets the irc password

func (*Connection) SetThrottle

func (c *Connection) SetThrottle(d time.Duration)

SetThrottle sets post delay

func (*Connection) Start

func (c *Connection) Start()

Start the bot

func (*Connection) Topic

func (c *Connection) Topic(channel, topic string)

Topic sets the channel 'channel' topic (requires bot has proper permissions)

func (*Connection) WaitFor

func (c *Connection) WaitFor(filter func(*Message) bool, cmd func(), timeout time.Duration, timeoutErr error) (err error)

WaitFor will block until a message matching the given filter is received

type Message

type Message struct {
	*irc.Message
	Content   string
	TimeStamp time.Time
	To        string
}

Message event

func NewMessage

func NewMessage() *Message

NewMessage returns an empty message

func ParseMessage

func ParseMessage(raw *irc.Message) (m *Message)

ParseMessage converts irc.Message to Message

type Trigger

type Trigger struct {
	Condition func(*Message) bool
	Response  func(*Message)
}

Trigger scheme

Jump to

Keyboard shortcuts

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