irc

package
v0.0.0-...-117abf3 Latest Latest
Warning

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

Go to latest
Published: Oct 20, 2022 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MessageTypePrivmsg         = "PRIVMSG"
	MessageTypeNotice          = "NOTICE"
	MessageTypePing            = "PING"
	MessageTypePong            = "PONG"
	MessageTypeCap             = "CAP"
	MessageType001             = "001"
	MessageType002             = "002"
	MessageType003             = "003"
	MessageType004             = "004"
	MessageType353             = "353"
	MessageType366             = "366"
	MessageType372             = "372"
	MessageType375             = "375"
	MessageType376             = "376"
	MessageTypeUnknown         = "UNKNOWN"
	MessageTypeJoin            = "JOIN"
	MessageTypePart            = "PART"
	MessageTypeGlobalUserState = "GLOBALUSERSTATE"
	MessageTypeWhisper         = "WHISPER"
	MessageTypeRoomState       = "ROOMSTATE"
	MessageTypeUserState       = "USERSTATE"
	MessageTypeClearChat       = "CLEARCHAT"
	MessageTypeReconnect       = "RECONNECT"
	MessageTypeUserNotice      = "USERNOTICE"

	MsgIdChannelSuspended = "msg_channel_suspended"
	MsgIdBanned           = "msg_banned"
)

Variables

This section is empty.

Functions

func ParseTags

func ParseTags(msg string) (map[string]string, int, error)

Types

type Client

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

func New

func New(username string, oauth string, openConnLimiter func()) *Client

func (*Client) Connect

func (c *Client) Connect(ctx context.Context) error

func (*Client) IsConnected

func (c *Client) IsConnected() bool

func (*Client) SetOAuth

func (c *Client) SetOAuth(oauth string)

func (*Client) SetOnConnect

func (c *Client) SetOnConnect(f func())

func (*Client) SetOnMessage

func (c *Client) SetOnMessage(f func(Message))

func (*Client) SetOnReconnect

func (c *Client) SetOnReconnect(f func())

func (*Client) Shutdown

func (c *Client) Shutdown()

func (*Client) Write

func (c *Client) Write(msg string) error

type IrcTags

type IrcTags map[string]string

func (IrcTags) Banned

func (i IrcTags) Banned() bool

func (IrcTags) ChannelSuspended

func (i IrcTags) ChannelSuspended() bool

func (IrcTags) MessageID

func (i IrcTags) MessageID() string

type Message

type Message struct {
	Raw     string
	Source  string
	Type    MessageType
	Channel string
	User    string
	Content string
	Tags    IrcTags
}

func ParseMessage

func ParseMessage(line string) (Message, error)

type MessageType

type MessageType string

func ToMessageType

func ToMessageType(s string) MessageType

Jump to

Keyboard shortcuts

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