package main import ( room "git.fromouter.space/mcg/cardgage/room/api" ) type draftBot struct { Name string Sessions map[string]session } func newDraftBot(name string) *draftBot { return &draftBot{ Name: name, Sessions: make(map[string]session), } } func (d *draftBot) onMessage(msg room.ServerMessage) { switch msg.Type { case room.MsgMessage: if *logAll { logger.Log("event", "message", "roomid", msg.RoomID, "from", msg.Message.From, "to", msg.Message.To, "content", msg.Message.Message) } // Only consider messages that speak directly to me if msg.Message.To == d.Name { d.handleMessage(*msg.Message) } case room.MsgEvent: if *logAll { logger.Log("event", "event", "roomid", msg.RoomID, "content", msg.Event.Message) } } } func (d *draftBot) handleMessage(msg room.Message) { //TODO }