<commit_before>package irc

import (
	"fmt"
	ircevent "github.com/thoj/go-ircevent"
	"github.com/tyler-sommer/squircy2/squircy/event"
)

const (
	PrivmsgEvent    event.EventType = "irc.PRIVMSG"
	NoticeEvent                     = "irc.NOTICE"
	ConnectEvent                    = "irc.CONNECT"
	ConnectingEvent                 = "irc.CONNECTING"
	DisconnectEvent                 = "irc.DISCONNECT"
	IrcEvent                        = "irc.WILDCARD"
)

func bindEvents(mgr *IrcConnectionManager, e event.EventManager) {
	mgr.conn.AddCallback("*", func(ev *ircevent.Event) {
		e.Trigger(IrcEvent, newEventData(ev))
		e.Trigger(event.EventType("irc."+ev.Code), newEventData(ev))
	})

	mgr.conn.AddCallback("001", func(ev *ircevent.Event) {
		fmt.Println("Connected")
		mgr.status = Connected
		e.Trigger(ConnectEvent, newEventData(ev))
	})

	mgr.conn.AddCallback("ERROR", func(ev *ircevent.Event) {
		if mgr.status != Disconnected {
			mgr.Quit()
		}
		e.Trigger(DisconnectEvent, newEventData(ev))
	})
}

func triggerConnecting(e event.EventManager) {
	e.Trigger(ConnectingEvent, nil)
}

func newEventData(ev *ircevent.Event) map[string]interface{} {
	return map[string]interface{}{
		"Event":   ev,
		"Code":    ev.Code,
		"Message": ev.Message(),
		"Nick":    ev.Nick,
		"Target":  ev.Arguments[0],
	}
}<commit_msg>Modified event emission in irc module<commit_after>package irc

import (
	"fmt"
	ircevent "github.com/thoj/go-ircevent"
	"github.com/tyler-sommer/squircy2/squircy/event"
)

const (
	PrivmsgEvent    event.EventType = "irc.PRIVMSG"
	NoticeEvent                     = "irc.NOTICE"
	ConnectEvent                    = "irc.CONNECT"
	ConnectingEvent                 = "irc.CONNECTING"
	DisconnectEvent                 = "irc.DISCONNECT"
	IrcEvent                        = "irc.WILDCARD"
)

func bindEvents(mgr *IrcConnectionManager, e event.EventManager) {
	mgr.conn.AddCallback("*", func(ev *ircevent.Event) {
		e.Trigger(IrcEvent, newEventData(ev))
		e.Trigger(event.EventType("irc."+ev.Code), newEventData(ev))
	})

	mgr.conn.AddCallback("001", func(ev *ircevent.Event) {
		fmt.Println("Connected")
		mgr.status = Connected
		e.Trigger(ConnectEvent, newEventData(ev))
	})

	mgr.conn.AddCallback("ERROR", func(ev *ircevent.Event) {
		if mgr.status != Disconnected {
			mgr.Quit()
		}
		e.Trigger(DisconnectEvent, newEventData(ev))
	})
}

func triggerConnecting(e event.EventManager) {
	e.Trigger(ConnectingEvent, nil)
}

func newEventData(ev *ircevent.Event) map[string]interface{} {
	return map[string]interface{}{
		"User":    ev.User,
		"Host":    ev.Host,
		"Source":  ev.Source,
		"Code":    ev.Code,
		"Message": ev.Message(),
		"Nick":    ev.Nick,
		"Target":  ev.Arguments[0],
	}
}
{'fraction_non_alphanumeric': 0.14879406307977736, 'fraction_numerical': 0.0037105751391465678, 'mean_word_length': 3.306709265175719, 'pattern_counts': {'":': 12, '<': 3, '<?xml version=': 0, '>': 3, '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': '5750137', 'n_tokens_mistral': 1039, 'n_tokens_neox': 991, 'n_words': 151}