diff --git a/entity/actor/handler.go b/entity/actor/handler.go index c36f790..a79c958 100644 --- a/entity/actor/handler.go +++ b/entity/actor/handler.go @@ -12,14 +12,14 @@ var ErrInvalidDotContentType = fmt.Errorf("actor: invalid content type for dot m func (a *Actor) defaultMessageHandler(m *msg.Message) error { switch m.Type { - case msg.DOT: - return a.handleDotMessage(m) + case msg.AT: + return a.handleAtMessage(m) default: return msg.ErrInvalidType } } -func (a *Actor) handleDotMessage(m *msg.Message) error { +func (a *Actor) handleAtMessage(m *msg.Message) error { // Only receive messages with default content type if m.ContentType != msg.DEFAULT_CONTENT_TYPE { @@ -28,7 +28,7 @@ func (a *Actor) handleDotMessage(m *msg.Message) error { var cmd string - msgStr := strings.TrimPrefix(string(m.Content), ".") + msgStr := strings.TrimPrefix(string(m.Content), "@") elements := strings.Split(msgStr, " ") if len(elements) == 0 { diff --git a/go.mod b/go.mod index 9b0504d..1b0e18a 100644 --- a/go.mod +++ b/go.mod @@ -5,7 +5,7 @@ go 1.22 require ( github.com/adrg/xdg v0.4.0 github.com/ayush6624/go-chatgpt v0.3.0 - github.com/bahner/go-ma v0.7.7-0.20240412234107-a34c2121822d + github.com/bahner/go-ma v0.7.7-0.20240412235320-63dbdd4090f2 github.com/ergo-services/ergo v1.999.224 github.com/fsnotify/fsnotify v1.7.0 github.com/fxamacker/cbor/v2 v2.6.0 diff --git a/go.sum b/go.sum index 60f80e1..995b6f4 100644 --- a/go.sum +++ b/go.sum @@ -72,6 +72,8 @@ github.com/bahner/go-ma v0.7.7-0.20240412233014-cca9fc3aa0a4 h1:a/3zg7XWrAhreCPd github.com/bahner/go-ma v0.7.7-0.20240412233014-cca9fc3aa0a4/go.mod h1:IgMPcdPzH1GkP5mMz2PhJh8831hGi4TzhYbOV8UFzZ0= github.com/bahner/go-ma v0.7.7-0.20240412234107-a34c2121822d h1:6b3kZiRDZFBaXtBPkD3M1OfR3ZF5buVEmSGJ+XjOvnQ= github.com/bahner/go-ma v0.7.7-0.20240412234107-a34c2121822d/go.mod h1:IgMPcdPzH1GkP5mMz2PhJh8831hGi4TzhYbOV8UFzZ0= +github.com/bahner/go-ma v0.7.7-0.20240412235320-63dbdd4090f2 h1:3rpxKmh+r7BriXW7H12rUkAAA92febakwqJFQwNpxaM= +github.com/bahner/go-ma v0.7.7-0.20240412235320-63dbdd4090f2/go.mod h1:IgMPcdPzH1GkP5mMz2PhJh8831hGi4TzhYbOV8UFzZ0= github.com/benbjohnson/clock v1.1.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA= github.com/benbjohnson/clock v1.3.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA= github.com/benbjohnson/clock v1.3.5 h1:VvXlSJBzZpA/zum6Sj74hxwYI2DIxRWuNIoXAzHZz5o= diff --git a/ui/chat.go b/ui/chat.go index c5bc27c..27f966d 100644 --- a/ui/chat.go +++ b/ui/chat.go @@ -48,7 +48,7 @@ func (ui *ChatUI) displaySentPrivateMessage(cm *msg.Message) { log.Debugf("entity lookup error: %s", err) return } - prompt := withColor("green", fmt.Sprintf("@%s:", e.Nick())) + prompt := withColor("green", fmt.Sprintf(".%s:", e.Nick())) fmt.Fprintf(ui.msgW, "%s %s\n", prompt, string(cm.Content)) } diff --git a/ui/events.go b/ui/events.go index 10f4326..008c165 100644 --- a/ui/events.go +++ b/ui/events.go @@ -49,7 +49,7 @@ func (ui *ChatUI) handleEvents() { ui.handleCommands(input) continue } - if strings.HasPrefix(input, "@") { + if strings.HasPrefix(input, ".") { log.Debug("handleEvents got command: ", input) ui.handleMsgCommand(input) continue diff --git a/ui/help.go b/ui/help.go index 92a7872..c5ff71a 100644 --- a/ui/help.go +++ b/ui/help.go @@ -37,7 +37,7 @@ func (ui *ChatUI) handleHelpCommands(args []string) { ui.displayHelpText(helpText) ui.displaySystemMessage("") ui.displaySystemMessage("Available commands:") - ui.displaySystemMessage("/help @") + ui.displaySystemMessage("/help .") ui.displaySystemMessage("/help '") ui.displaySystemMessage("/help broadcast") ui.displaySystemMessage("/help enter") @@ -56,7 +56,7 @@ func (ui *ChatUI) handleHelpCommands(args []string) { ui.displaySystemMessage("/help") } else { switch args[1] { - case "@": + case ".": ui.handleHelpCommand(msgUsage, msgHelp) case "'": ui.handleHelpCommand(editorUsage, editorHelp) diff --git a/ui/history.go b/ui/history.go index 1c3a418..5b003c3 100644 --- a/ui/history.go +++ b/ui/history.go @@ -34,7 +34,7 @@ func (ui *ChatUI) pushToHistory(line string) { func appendToPersistentHistory(text string) error { if !(strings.HasPrefix(text, "/") || - strings.HasPrefix(text, "@")) { + strings.HasPrefix(text, ".")) { return nil } diff --git a/ui/msg.go b/ui/msg.go index 1e9d6bf..7fcfced 100644 --- a/ui/msg.go +++ b/ui/msg.go @@ -12,7 +12,7 @@ import ( ) const ( - msgUsage = "/@ " + msgUsage = "/. " msgHelp = "Sends a private message directly the specified DID" ) @@ -22,7 +22,7 @@ func (ui *ChatUI) handleMsgCommand(input string) { if len(parts) == 2 { - recipient := parts[0][1:] // The recipient is the first argument, without the leading @ + recipient := parts[0][1:] // The recipient is the first argument, without the leading . if !did.IsValid(recipient) { recipient = entity.Lookup(recipient) }