<commit_before>package main

import (
	"bufio"
	"flag"
	"fmt"
	"gopkg.in/sorcix/irc.v2"
	"log"
	"os"
	"os/user"
	"strings"
)

var target string

func printmsg(msg *irc.Message) {
	switch msg.Command {
	case "JOIN":
		fmt.Printf("%s has joined %s\n", msg.Prefix.Name, msg.Params[0])
	case "PRIVMSG":
		fmt.Printf("%s/%s: %s\n", msg.Prefix.Name, msg.Params[0], msg.Params[1])
	case "MODE":
		fmt.Printf("%s sets mode %s\n", msg.Prefix.Name, strings.Join(msg.Params[0:], " "))
	case "NOTICE":
		fmt.Printf("Notice from %s to %s: %s\n", msg.Prefix.Name, msg.Params[0], msg.Params[1])
	case "001":
		fallthrough
	case "002":
		fallthrough
	case "003":
		fallthrough
	case "372":
		fallthrough
	case "375":
		fallthrough
	case "376":
		fmt.Println(msg.Params[1])
	case "QUIT":
		fmt.Printf("%s has quit (%s)\n", msg.Prefix.Name, msg.Params[0])
	default:
		fmt.Println("RAW:", msg.String())
	}
}

func Parse(text string) (string, bool) {
	if text[0] == '/' {
		words := strings.Split(text, " ")
		if words[0] == "/t" && len(words) > 1 {
			target = words[1]
			return "", false
		}
		if words[0] == "/r" && len(words) > 1 {
			return strings.Join(words[1:], " "), true
		}
		if words[0] == "/j" && len(words) > 1 {
			return fmt.Sprintf("JOIN %s", words[1]), true
		}
		if words[0] == "/m" && len(words) > 2 {
			return fmt.Sprintf("PRIVMSG %s :%s", words[1], strings.Join(words[2:], " ")), true
		}
		if words[0] == "/n" && len(words) > 2 {
			return fmt.Sprintf("NOTICE %s :%s", words[1], strings.Join(words[2:], " ")), true
		}
	}
	return strings.Replace(fmt.Sprintf("PRIVMSG %s :%s", target, text), "\n", "", -1), target != ""
}

func Command(client *Client, text string) {
	send, dosend := Parse(text)
	if dosend {
		msg := irc.ParseMessage(send)
		if msg != nil {
			client.Send(msg)
		}
	}
}

func readloop(client *Client) {<commit_msg>capital N for notice; n for nick<commit_after>package main

import (
	"bufio"
	"flag"
	"fmt"
	"gopkg.in/sorcix/irc.v2"
	"log"
	"os"
	"os/user"
	"strings"
)

var target string

func printmsg(msg *irc.Message) {
	switch msg.Command {
	case "JOIN":
		fmt.Printf("%s has joined %s\n", msg.Prefix.Name, msg.Params[0])
	case "PRIVMSG":
		fmt.Printf("%s/%s: %s\n", msg.Prefix.Name, msg.Params[0], msg.Params[1])
	case "MODE":
		fmt.Printf("%s sets mode %s\n", msg.Prefix.Name, strings.Join(msg.Params[0:], " "))
	case "NOTICE":
		fmt.Printf("Notice from %s to %s: %s\n", msg.Prefix.Name, msg.Params[0], msg.Params[1])
	case "001":
		fallthrough
	case "002":
		fallthrough
	case "003":
		fallthrough
	case "372":
		fallthrough
	case "375":
		fallthrough
	case "376":
		fmt.Println(msg.Params[1])
	case "QUIT":
		fmt.Printf("%s has quit (%s)\n", msg.Prefix.Name, msg.Params[0])
	default:
		fmt.Println("RAW:", msg.String())
	}
}

func Parse(text string) (string, bool) {
	if text[0] == '/' {
		words := strings.Split(text, " ")
		if words[0] == "/t" && len(words) > 1 {
			target = words[1]
			return "", false
		}
		if words[0] == "/r" && len(words) > 1 {
			return strings.Join(words[1:], " "), true
		}
		if words[0] == "/j" && len(words) > 1 {
			return fmt.Sprintf("JOIN %s", words[1]), true
		}
		if words[0] == "/m" && len(words) > 2 {
			return fmt.Sprintf("PRIVMSG %s :%s", words[1], strings.Join(words[2:], " ")), true
		}
		if words[0] == "/N" && len(words) > 2 {
			return fmt.Sprintf("NOTICE %s :%s", words[1], strings.Join(words[2:], " ")), true
		}
		if words[0] == "/n" && len(words) > 1 {
			return fmt.Sprintf("NICK %s", words[1]), true
		}
	}
	return strings.Replace(fmt.Sprintf("PRIVMSG %s :%s", target, text), "\n", "", -1), target != ""
}

func Command(client *Client, text string) {
	send, dosend := Parse(text)
	if dosend {
		msg := irc.ParseMessage(send)
		if msg != nil {
			client.Send(msg)
		}
	}
}

func readloop(client *Client) {
{'fraction_non_alphanumeric': 0.21896460644479662, 'fraction_numerical': 0.025092445853143158, 'mean_word_length': 3.5792019347037485, 'pattern_counts': {'":': 22, '<': 3, '<?xml version=': 0, '>': 14, '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': '990790', 'n_tokens_mistral': 1673, 'n_tokens_neox': 1560, 'n_words': 356}