some doc on structs
This commit is contained in:
parent
5baf7671c6
commit
eef65b116e
@ -10,6 +10,7 @@ import (
|
|||||||
"time"
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
func (irc *Connection) AddCallback(eventcode string, callback func(*Event)) string {
|
func (irc *Connection) AddCallback(eventcode string, callback func(*Event)) string {
|
||||||
eventcode = strings.ToUpper(eventcode)
|
eventcode = strings.ToUpper(eventcode)
|
||||||
|
|
||||||
|
@ -43,6 +43,8 @@ type Connection struct {
|
|||||||
stopped bool
|
stopped bool
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// A struct to represent an event.
|
||||||
type Event struct {
|
type Event struct {
|
||||||
Code string
|
Code string
|
||||||
Raw string
|
Raw string
|
||||||
@ -53,7 +55,8 @@ type Event struct {
|
|||||||
Arguments []string
|
Arguments []string
|
||||||
}
|
}
|
||||||
|
|
||||||
// Convenience func to get the last arg, now that the Message field is gone
|
|
||||||
|
// Extract the last message from an Event. This function eventually returns an empty string.
|
||||||
func (e *Event) Message() string {
|
func (e *Event) Message() string {
|
||||||
if len(e.Arguments) == 0 {
|
if len(e.Arguments) == 0 {
|
||||||
return ""
|
return ""
|
||||||
|
Loading…
Reference in New Issue
Block a user