37 lines
535 B
Go
37 lines
535 B
Go
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,
|
|
}
|
|
}
|