Nick already in use callback
This commit is contained in:
parent
efcb5f679d
commit
32ab9f2259
@ -24,7 +24,7 @@ func (irc *IRCConnection) AddCallback(eventcode string, callback func(*IRCEvent)
|
||||
func (irc *IRCConnection) ReplaceCallback(i uint8, eventcode string, callback func(*IRCEvent)) {
|
||||
eventcode = strings.ToUpper(eventcode)
|
||||
if event, ok := irc.events[eventcode]; ok {
|
||||
event[i] = callback;
|
||||
event[i] = callback
|
||||
} else {
|
||||
event = make([]func(*IRCEvent), 1, 20)
|
||||
event[0] = callback
|
||||
@ -89,6 +89,11 @@ func (irc *IRCConnection) setupCallbacks() {
|
||||
irc.SendRaw(fmt.Sprintf("NICK %s", irc.nick))
|
||||
})
|
||||
|
||||
irc.AddCallback("433", func(e *IRCEvent) {
|
||||
irc.nick = irc.nick + "_"
|
||||
irc.SendRaw(fmt.Sprintf("NICK %s", irc.nick))
|
||||
})
|
||||
|
||||
irc.AddCallback("PONG", func(e *IRCEvent) {
|
||||
ns, _ := strconv.Atoi64(e.Message)
|
||||
fmt.Printf("Lag: %fs\n", float((time.Nanoseconds()-ns))/1000/1000/1000)
|
||||
|
Loading…
Reference in New Issue
Block a user