irc/pkg/ircv3/event.go

37 lines
535 B
Go
Raw Normal View History

2024-05-15 09:28:02 +00:00
package ircv3
import "context"
type EventType = string
const (
EventTypeIRC EventType = "irc"
EventTypeCONTROL EventType = "control"
)
type Event struct {
Type EventType
Msg *Message
ctx context.Context
}
func NewEvent(ctx context.Context, t EventType, msg *Message) *Event {
return &Event{
ctx: ctx,
Msg: msg,
Type: t,
}
}
func (e *Event) Context() context.Context {
return e.ctx
}
func (e *Event) WithContext(ctx context.Context) *Event {
return &Event{
Msg: e.Msg,
Type: e.Type,
ctx: ctx,
}
}