diff options
Diffstat (limited to '')
| -rw-r--r-- | internal/chat/chat.go | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/internal/chat/chat.go b/internal/chat/chat.go index 4a639ba..1639d6b 100644 --- a/internal/chat/chat.go +++ b/internal/chat/chat.go @@ -15,6 +15,12 @@ var ( "/join [chan] - change current channel to [chan]\n" + "/chans - list all chans\n" + "/users - list all online users\n" + + "/me [message] - display message like from third person\n" + + "Formatting:\n" + + "- *Bold*\n" + + "- +Italic+\n" + + "- -Striked-\n" + + "- _Underline_\n" + "ctrl+c - leave chat" ) @@ -55,18 +61,18 @@ func (c *Chat) NewUser(username, identify string) *User { Events: make(chan any, 32), mu: sync.RWMutex{}, } + u.Events <- SystemMessage{ + Message: fmt.Sprintf("Connected to %s chat server...\nType /help command for list available commands.", c.cfg.Server.Name), + } ch := c.GetChannel("main") + if ch != nil { u.JoinChan(ch) } c.users[u] = struct{}{} - u.Events <- SystemMessage{ - Message: fmt.Sprintf("Connected to %s chat server...", c.cfg.Server.Name), - } - return u } @@ -170,8 +176,7 @@ func (c *Chat) Input(ctx context.Context, user *User, input string) { newChan = c.NewChannel(ctx, newChanName) } user.CurrentChan.Leave(user) - user.CurrentChan = newChan - newChan.Join(user) + user.JoinChan(newChan) default: c.Message(user, input) } |
