fix
This commit is contained in:
4
main.go
4
main.go
@@ -11,7 +11,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
// //////////////////////
|
// //////////////////////
|
||||||
var isTest bool = false
|
var isTest bool = true
|
||||||
|
|
||||||
////////////////////////
|
////////////////////////
|
||||||
|
|
||||||
@@ -29,7 +29,7 @@ func testConfig() models.Config {
|
|||||||
return models.Config{
|
return models.Config{
|
||||||
Token: "7757765456:AAFpFXhbi9XCfgRt7P3OT3F_jrBBplubWZA",
|
Token: "7757765456:AAFpFXhbi9XCfgRt7P3OT3F_jrBBplubWZA",
|
||||||
HostName: "217.12.40.237",
|
HostName: "217.12.40.237",
|
||||||
DbName: "stage",
|
DbName: "test",
|
||||||
UserName: "root",
|
UserName: "root",
|
||||||
Password: "12641264",
|
Password: "12641264",
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,17 +18,9 @@ func NewBonusController(b *tele.Bot, db *DataController) *BonusController {
|
|||||||
return &BonusController{DC: db, Bot: b}
|
return &BonusController{DC: db, Bot: b}
|
||||||
}
|
}
|
||||||
|
|
||||||
func SendChatToID(bot *tele.Bot, msg string, id int64) {
|
|
||||||
chat := &tele.Chat{ID: id}
|
|
||||||
_, err := bot.Send(chat, msg)
|
|
||||||
if err != nil {
|
|
||||||
fmt.Println(err)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func (b *BonusController) Bonus(c tele.Context) error {
|
func (b *BonusController) Bonus(c tele.Context) error {
|
||||||
var text string
|
var text string
|
||||||
var chatID int64 = -1002345923642
|
var msg *tele.Message
|
||||||
|
|
||||||
user := b.DC.GetUser(c.Sender().ID)
|
user := b.DC.GetUser(c.Sender().ID)
|
||||||
if !user.Admin {
|
if !user.Admin {
|
||||||
@@ -51,23 +43,29 @@ func (b *BonusController) Bonus(c tele.Context) error {
|
|||||||
row := btn.Row(btn.Data("Забрать", "add_bonus", fmt.Sprintf("%d", giftSumm)+":"+fmt.Sprintf("%d", c.Sender().ID)))
|
row := btn.Row(btn.Data("Забрать", "add_bonus", fmt.Sprintf("%d", giftSumm)+":"+fmt.Sprintf("%d", c.Sender().ID)))
|
||||||
btn.Inline(row)
|
btn.Inline(row)
|
||||||
|
|
||||||
msg, err := b.Bot.Send(
|
msg, err = b.Bot.Send(
|
||||||
&tele.Chat{ID: chatID},
|
&tele.Chat{ID: -1002345923642},
|
||||||
fmt.Sprintf("Успей забрать бонус.\nСумма: %d", giftSumm),
|
fmt.Sprintf("Успей забрать бонус.\nСумма: %d", giftSumm),
|
||||||
btn,
|
btn,
|
||||||
)
|
)
|
||||||
|
|
||||||
b.Bot.Handle(&row[0], func(c tele.Context) error {
|
|
||||||
user := b.DC.GetUser(c.Sender().ID)
|
|
||||||
newSize := user.DickSize + giftSumm
|
|
||||||
b.DC.UpdateDick(c.Sender().ID, newSize)
|
|
||||||
b.Bot.Edit(msg, fmt.Sprintf("%s получает бонус: %d", c.Sender().FirstName, giftSumm))
|
|
||||||
return nil
|
|
||||||
})
|
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Println(err)
|
log.Println(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
b.Bot.Handle(&row[0], func(c tele.Context) error {
|
||||||
|
user := b.DC.GetUser(c.Sender().ID)
|
||||||
|
newSize := user.DickSize + giftSumm
|
||||||
|
|
||||||
|
b.DC.UpdateDick(c.Sender().ID, newSize)
|
||||||
|
_, err := b.Bot.Edit(msg, fmt.Sprintf("%s получает бонус: %d", c.Sender().FirstName, giftSumm))
|
||||||
|
if err != nil {
|
||||||
|
log.Println(err)
|
||||||
|
}
|
||||||
|
|
||||||
|
return c.Send("Поздравляем")
|
||||||
|
})
|
||||||
|
|
||||||
fmt.Println(giftSumm)
|
fmt.Println(giftSumm)
|
||||||
|
|
||||||
return c.Send(fmt.Sprintf("Бонус запущен: %d", giftSumm))
|
return c.Send(fmt.Sprintf("Бонус запущен: %d", giftSumm))
|
||||||
|
|||||||
Reference in New Issue
Block a user