31 lines
584 B
Go
31 lines
584 B
Go
|
package main
|
||
|
|
||
|
import (
|
||
|
room "git.fromouter.space/mcg/cardgage/room/api"
|
||
|
)
|
||
|
|
||
|
type draftBot struct {
|
||
|
Sessions map[string]session
|
||
|
}
|
||
|
|
||
|
func newDraftBot() *draftBot {
|
||
|
return &draftBot{
|
||
|
Sessions: make(map[string]session),
|
||
|
}
|
||
|
}
|
||
|
|
||
|
func (d *draftBot) onMessage(msg room.ServerMessage) {
|
||
|
switch msg.Type {
|
||
|
case room.MsgMessage:
|
||
|
logger.Log("event", "message",
|
||
|
"roomid", msg.RoomID,
|
||
|
"from", msg.Message.From,
|
||
|
"to", msg.Message.To,
|
||
|
"content", msg.Message.Message)
|
||
|
case room.MsgEvent:
|
||
|
logger.Log("event", "event",
|
||
|
"roomid", msg.RoomID,
|
||
|
"content", msg.Event.Message)
|
||
|
}
|
||
|
}
|