diff options
author | Hubert Hirtz <hubert@hirtz.pm> | 2021-05-18 12:16:13 +0200 |
---|---|---|
committer | Hubert Hirtz <hubert@hirtz.pm> | 2021-05-18 12:17:12 +0200 |
commit | a0e0d6c3a7a93db7a3caec9c2fd3ecaab47d31a8 (patch) | |
tree | 3e201e0b7ce741cd2823fc9d251e9b73056f5d66 /irc | |
parent | Add port if missing (v2) and don't set keepalives (diff) |
Add /nick
Diffstat (limited to 'irc')
-rw-r--r-- | irc/states.go | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/irc/states.go b/irc/states.go index 957286d..d1ead27 100644 --- a/irc/states.go +++ b/irc/states.go @@ -88,6 +88,10 @@ type ( raw string } + actionChangeNick struct { + Nick string + } + actionJoin struct { Channel string } @@ -424,6 +428,15 @@ func splitChunks(s string, chunkLen int) (chunks []string) { return } +func (s *Session) ChangeNick(nick string) { + s.acts <- actionChangeNick{nick} +} + +func (s *Session) changeNick(act actionChangeNick) (err error) { + err = s.send("NICK %s\r\n", act.Nick) + return +} + func (s *Session) PrivMsg(target, content string) { s.acts <- actionPrivMsg{target, content} } @@ -519,6 +532,8 @@ func (s *Session) run() { switch act := act.(type) { case actionSendRaw: err = s.sendRaw(act) + case actionChangeNick: + err = s.changeNick(act) case actionJoin: err = s.join(act) case actionPart: |