MCPcopy Create free account
hub / github.com/babycommando/nightride-cli / handleSlash

Method handleSlash

zuse.go:764–836  ·  view source on GitHub ↗

* SLASH CMDS */

(s *serverEntry, raw string)

Source from the content-addressed store, hash-verified

762/* SLASH CMDS */
763
764func (m *ircModel) handleSlash(s *serverEntry, raw string) tea.Cmd {
765 parts := strings.SplitN(strings.TrimPrefix(raw, "/"), " ", 2)
766 cmd := strings.ToLower(parts[0])
767 arg := ""
768 if len(parts) == 2 {
769 arg = parts[1]
770 }
771 logSys := func(t string) {
772 m.pushSysLine(s.id, m.activeChan, t)
773 m.refreshChat()
774 }
775
776 switch cmd {
777 case "join":
778 if arg == "" {
779 logSys("usage: /join #chan")
780 return nil
781 }
782 if s.client != nil && s.connected {
783 s.client.Cmd.Join(arg)
784 }
785 if !contains(s.channels, arg) {
786 s.channels = append(s.channels, arg)
787 }
788 if s.joined == nil {
789 s.joined = map[string]bool{}
790 }
791 s.joined[arg] = true
792
793 ascii := styleDim.Render("─── Chat initialized ───")
794 s.channelLogs[arg] = append(s.channelLogs[arg], ascii)
795
796 logSys("-- joined " + arg + " --")
797
798 copy := *s
799 copy.channel = arg
800 return addListItemCmd(copy)
801
802 case "nick":
803 if arg == "" {
804 logSys("usage: /nick newnick")
805 return nil
806 }
807 if s.client != nil {
808 s.client.Cmd.Nick(arg)
809 }
810 logSys("-- nick change requested: " + arg)
811 return nil
812
813 case "quit":
814 if s.client != nil {
815 s.client.Quit("bye")
816 }
817 return nil
818
819 case "msg":
820 p := strings.SplitN(arg, " ", 2)
821 if len(p) < 2 {

Callers 1

updateChatMethod · 0.95

Calls 4

pushSysLineMethod · 0.95
refreshChatMethod · 0.95
containsFunction · 0.85
addListItemCmdFunction · 0.85

Tested by

no test coverage detected