Merge branch 'main' of https://github.com/RexReposit/dickbot
This commit is contained in:
@@ -45,42 +45,42 @@ func (s *DuelController) StartMatch(c tele.Context) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var text string
|
var text string
|
||||||
|
user := s.DC.GetUser(s.PlayerOne.ID)
|
||||||
|
|
||||||
if strings.Contains(c.Text(), " ") {
|
if strings.Contains(c.Data(), " ") {
|
||||||
text = strings.Split(c.Text(), " ")[1]
|
text = strings.Split(c.Text(), " ")[1]
|
||||||
fmt.Println("new command", text)
|
fmt.Println("Ставка", text)
|
||||||
} else {
|
} else {
|
||||||
|
s.Inited = false
|
||||||
return c.Send("Некоректная команда, используйте /duel <сумма>")
|
return c.Send("Некоректная команда, используйте /duel <сумма>")
|
||||||
}
|
}
|
||||||
|
|
||||||
summ, err := strconv.Atoi(text)
|
summ, err := strconv.Atoi(text)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
s.Inited = false
|
||||||
return c.Send("Некорректная команда, используйте /duel <сумма>")
|
return c.Send("Некорректная команда, используйте /duel <сумма>")
|
||||||
} else {
|
|
||||||
s.Summ = summ
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if summ <= 0 {
|
|
||||||
return c.Send("Некорректная сумма, используйте положительное значение!")
|
|
||||||
}
|
|
||||||
|
|
||||||
s.Inited = true
|
|
||||||
s.PlayerOne.ID = c.Sender().ID
|
|
||||||
s.PlayerOne.FName = c.Sender().FirstName
|
|
||||||
|
|
||||||
user := s.DC.GetUser(s.PlayerOne.ID)
|
|
||||||
|
|
||||||
if user.DickSize < summ {
|
if user.DickSize < summ {
|
||||||
|
s.Inited = false
|
||||||
return c.Send("У вас недостаточно длинный пенис для состязания!")
|
return c.Send("У вас недостаточно длинный пенис для состязания!")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
s.PlayerOne.ID = c.Sender().ID
|
||||||
|
s.PlayerOne.FName = c.Sender().FirstName
|
||||||
|
s.Inited = true
|
||||||
|
|
||||||
return c.Send(fmt.Sprintf("%s начал дуель, ставка: %d", s.PlayerOne.FName, summ))
|
return c.Send(fmt.Sprintf("%s начал дуель, ставка: %d", s.PlayerOne.FName, summ))
|
||||||
}
|
}
|
||||||
|
|
||||||
// Accept Match
|
// Accept Match
|
||||||
func (s *DuelController) AcceptMatch(c tele.Context) error {
|
func (s *DuelController) AcceptMatch(c tele.Context) error {
|
||||||
if !s.Inited {
|
if !s.Inited {
|
||||||
return c.Send("Дуэль еще не началась! Дождитесь старта матча или начните новую дуель с помощью /duel <сумма>")
|
return c.Send("Дуэль еще не началась! Дождитесь старта или начните новую дуель с помощью /duel <сумма>")
|
||||||
|
}
|
||||||
|
|
||||||
|
if s.Summ <= 0 {
|
||||||
|
return c.Send("Некорректная сумма, используйте положительное значение!")
|
||||||
}
|
}
|
||||||
|
|
||||||
s.PlayerTwo.ID = c.Sender().ID
|
s.PlayerTwo.ID = c.Sender().ID
|
||||||
@@ -104,44 +104,38 @@ func (s *DuelController) AcceptMatch(c tele.Context) error {
|
|||||||
|
|
||||||
// Start Game
|
// Start Game
|
||||||
func (s *DuelController) gameProccess(r tele.Recipient) {
|
func (s *DuelController) gameProccess(r tele.Recipient) {
|
||||||
time.Sleep(time.Second * 3)
|
msg, _ := s.Bot.Send(r, fmt.Sprintf("Дуэль началась!\nНа кону: %d", s.Summ))
|
||||||
s.Bot.Send(r, fmt.Sprintf("Дуэль началась!\nНа кону: %d", s.Summ))
|
|
||||||
s.RoundOne(r)
|
|
||||||
}
|
|
||||||
|
|
||||||
// Round One
|
// round 1
|
||||||
func (s *DuelController) RoundOne(r tele.Recipient) {
|
|
||||||
time.Sleep(time.Second * 3)
|
time.Sleep(time.Second * 3)
|
||||||
|
|
||||||
s.PlayerOne.Counter += rand.Intn(11) + 1
|
s.PlayerOne.Counter += rand.Intn(11) + 1
|
||||||
s.PlayerTwo.Counter += rand.Intn(11) + 1
|
s.PlayerTwo.Counter += rand.Intn(11) + 1
|
||||||
s.Bot.Send(r,
|
s.Bot.Edit(msg,
|
||||||
fmt.Sprintf("Результаты первого раунда\n%s: %d очков.\n%s: %d очков.",
|
fmt.Sprintf("Результаты первого раунда\n%s: %d очков.\n%s: %d очков.",
|
||||||
s.PlayerOne.FName, s.PlayerOne.Counter, s.PlayerTwo.FName, s.PlayerTwo.Counter),
|
s.PlayerOne.FName, s.PlayerOne.Counter, s.PlayerTwo.FName, s.PlayerTwo.Counter),
|
||||||
)
|
)
|
||||||
s.RoundTwo(r)
|
|
||||||
}
|
|
||||||
|
|
||||||
// Round Two
|
// round 2
|
||||||
func (s *DuelController) RoundTwo(r tele.Recipient) {
|
|
||||||
time.Sleep(time.Second * 3)
|
time.Sleep(time.Second * 3)
|
||||||
|
|
||||||
s.PlayerOne.Counter += rand.Intn(11) + 1
|
s.PlayerOne.Counter += rand.Intn(11) + 1
|
||||||
s.PlayerTwo.Counter += rand.Intn(11) + 1
|
s.PlayerTwo.Counter += rand.Intn(11) + 1
|
||||||
s.Bot.Send(r,
|
s.Bot.Edit(msg,
|
||||||
fmt.Sprintf("Результаты второго раунда\n%s: %d очков.\n%s: %d очков.",
|
fmt.Sprintf("Результаты второго раунда\n%s: %d очков.\n%s: %d очков.",
|
||||||
s.PlayerOne.FName, s.PlayerOne.Counter, s.PlayerTwo.FName, s.PlayerTwo.Counter),
|
s.PlayerOne.FName, s.PlayerOne.Counter, s.PlayerTwo.FName, s.PlayerTwo.Counter),
|
||||||
)
|
)
|
||||||
s.RoundThree(r)
|
|
||||||
}
|
|
||||||
|
|
||||||
// Round Three
|
// round 3
|
||||||
func (s *DuelController) RoundThree(r tele.Recipient) {
|
|
||||||
time.Sleep(time.Second * 3)
|
time.Sleep(time.Second * 3)
|
||||||
|
|
||||||
s.PlayerOne.Counter += rand.Intn(11) + 1
|
s.PlayerOne.Counter += rand.Intn(11) + 1
|
||||||
s.PlayerTwo.Counter += rand.Intn(11) + 1
|
s.PlayerTwo.Counter += rand.Intn(11) + 1
|
||||||
s.Bot.Send(r,
|
s.Bot.Edit(msg,
|
||||||
fmt.Sprintf("Результаты третьего раунда\n%s: %d очков.\n%s: %d очков.",
|
fmt.Sprintf("Результаты третьего раунда\n%s: %d очков.\n%s: %d очков.",
|
||||||
s.PlayerOne.FName, s.PlayerOne.Counter, s.PlayerTwo.FName, s.PlayerTwo.Counter),
|
s.PlayerOne.FName, s.PlayerOne.Counter, s.PlayerTwo.FName, s.PlayerTwo.Counter),
|
||||||
)
|
)
|
||||||
|
|
||||||
s.CheckWin(r)
|
s.CheckWin(r)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user