From 8c0b8ad931045c70845f662238230edb81f8cd94 Mon Sep 17 00:00:00 2001 From: Alexander Neonxp Kiryukhin Date: Wed, 31 Dec 2025 14:15:42 +0300 Subject: =?UTF-8?q?=D0=A1=D0=B4=D0=B5=D0=BB=D0=B0=D0=BB=20=D0=BA=D0=BE?= =?UTF-8?q?=D1=80=D1=80=D0=B5=D0=BA=D1=82=D0=BD=D1=83=D1=8E=20=D1=80=D0=B0?= =?UTF-8?q?=D0=B1=D0=BE=D1=82=D1=83=20=D1=81=20=D1=82=D0=B5=D1=80=D0=BC?= =?UTF-8?q?=D0=B8=D0=BD=D0=B0=D0=BB=D0=BE=D0=BC=20=D0=B8=20=D0=B8=D1=81?= =?UTF-8?q?=D1=82=D0=BE=D1=80=D0=B8=D1=8E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- internal/chat/chat.go | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) (limited to 'internal/chat/chat.go') 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) } -- cgit v1.2.3