diff --git a/main.go b/main.go index c87b7c9..4b80430 100644 --- a/main.go +++ b/main.go @@ -11,7 +11,7 @@ import ( ) // ////////////////////// -var isTest bool = false +var isTest bool = true //////////////////////// diff --git a/src/controllers/duelController.go b/src/controllers/duelController.go index 1411f4c..28f7671 100644 --- a/src/controllers/duelController.go +++ b/src/controllers/duelController.go @@ -24,10 +24,11 @@ type DuelController struct { FName string } - Summ int - Inited bool - Bot *tele.Bot - DC *DataController + Summ int + Inited bool + MatchAccepted bool + Bot *tele.Bot + DC *DataController } // Controller Init @@ -81,6 +82,10 @@ func (s *DuelController) StartMatch(c tele.Context) error { // Accept Match func (s *DuelController) AcceptMatch(c tele.Context) error { + if s.MatchAccepted { + return c.Send("Дождитесь окончания дуэли.") + } + if !s.Inited { return c.Send("Дуэль еще не началась! Дождитесь старта матча или начните новую дуель с помощью /duel <сумма>") } @@ -101,6 +106,8 @@ func (s *DuelController) AcceptMatch(c tele.Context) error { s.Summ *= 2 go s.gameProccess(c.Chat()) + s.MatchAccepted = true + return c.Send(fmt.Sprintf("%s принимает участие в дуэли.", s.PlayerTwo.FName)) } @@ -190,4 +197,5 @@ func (s *DuelController) CheckWin(msg *tele.Message) { s.PlayerTwo.Counter = 0 s.Summ = 0 s.Inited = false + s.MatchAccepted = false }