<commit_before>package joinCmd

import (
	"fmt"
	_ "log"
	"strings"
	"ircflu/commands"
	"ircflu/msgsystem"
)

type JoinCommand struct {
	messagesIn chan msgsystem.Message
	messagesOut chan msgsystem.Message
}

func (h *JoinCommand) Name() string {
	return "join"
}

func (h *JoinCommand) MessageInChan() chan msgsystem.Message {
	return h.messagesIn
}

func (h *JoinCommand) SetMessageInChan(channel chan msgsystem.Message) {
	h.messagesIn = channel
}

func (h *JoinCommand) MessageOutChan() chan msgsystem.Message {
	return h.messagesOut
}

func (h *JoinCommand) SetMessageOutChan(channel chan msgsystem.Message) {
	h.messagesOut = channel
}

func (h *JoinCommand) Parse(msg msgsystem.Message) bool {
	channel := msg.To
	m := strings.Split(msg.Msg, " ")
	cmd := m[0]
	params := strings.Join(m[1:], " ")

	switch cmd {
		case "!join":
			if len(params) > 0 {
				fmt.Println("Joining:", params)
//				h.client.Join(params)
			} else {
				r := msgsystem.Message{
					To: channel,
					Msg: "Usage: !join #chan  or  !join #chan key",
				}
				h.messagesOut <- r
			}
			return true

		case "!part":
			if len(params) > 0 {
				fmt.Println("Parting:", params)
//				h.client.Part(params)
			} else {
				r := msgsystem.Message{
					To: channel,
					Msg: "Usage: !part #chan",
				}
				h.messagesOut <- r
			}
			return true

		default:
			if !strings.HasPrefix(cmd, "!") {
				h.messagesOut <- msg
			}
	}
	return false
}

func init() {
	joinCmd := JoinCommand{}
	commands.RegisterCommand(&joinCmd)
}<commit_msg>* Split up Join & Part commands.<commit_after>package joinCmd

import (
	"fmt"
	_ "log"
	"strings"
	"ircflu/commands"
	"ircflu/msgsystem"
	"ircflu/msgsystem/irc"
)

type JoinCommand struct {
	messagesIn chan msgsystem.Message
	messagesOut chan msgsystem.Message
}

func (h *JoinCommand) Name() string {
	return "join"
}

func (h *JoinCommand) MessageInChan() chan msgsystem.Message {
	return h.messagesIn
}

func (h *JoinCommand) SetMessageInChan(channel chan msgsystem.Message) {
	h.messagesIn = channel
}

func (h *JoinCommand) MessageOutChan() chan msgsystem.Message {
	return h.messagesOut
}

func (h *JoinCommand) SetMessageOutChan(channel chan msgsystem.Message) {
	h.messagesOut = channel
}

func (h *JoinCommand) Parse(msg msgsystem.Message) bool {
	channel := msg.To
	m := strings.Split(msg.Msg, " ")
	cmd := m[0]
	params := strings.Join(m[1:], " ")

	switch cmd {
		case "!join":
			if len(params) > 0 {
				fmt.Println("Joining:", params)

				ircclient := (*msgsystem.SubSystem("irc")).(*irc.IrcSubSystem)
				if ircclient != nil {
					ircclient.Join(params)
				}
			} else {
				r := msgsystem.Message{
					To: channel,
					Msg: "Usage: !join #chan  or  !join #chan key",
				}
				h.messagesOut <- r
			}
			return true
	}
	return false
}

func init() {
	joinCmd := JoinCommand{}
	commands.RegisterCommand(&joinCmd)
}
{'fraction_non_alphanumeric': 0.13964912280701755, 'fraction_numerical': 0.002456140350877193, 'mean_word_length': 3.496845425867508, 'pattern_counts': {'":': 3, '<': 7, '<?xml version=': 0, '>': 6, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5792077', 'n_tokens_mistral': 1187, 'n_tokens_neox': 1025, 'n_words': 245}