From 98ccf5fe8a736a5c0c8b66dbd76ec0dff5f0cb42 Mon Sep 17 00:00:00 2001 From: Hamcha Date: Fri, 28 Jun 2019 21:56:47 +0200 Subject: [PATCH] Stub player replacement --- draftbot/draftbot.go | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/draftbot/draftbot.go b/draftbot/draftbot.go index 52f6378..8edb342 100644 --- a/draftbot/draftbot.go +++ b/draftbot/draftbot.go @@ -112,6 +112,22 @@ func (d *DraftBot) handleEvent(roomid string, evt room.Event) { Owner: evt.Room.Creator, } + // Someone left + case room.EvtLeft: + // Check if room has a running session + sess, ok := d.Sessions[roomid] + if !ok { + break + } + // Check if player is in that session + player, ok := sess.Players[evt.PlayerName] + if !ok { + break + } + // Replace player with bot + //TODO + _ = player + // A room got closed case room.EvtRoomClosed: // Check if there's a session there