Bastion chat is covered by orders now
This commit is contained in:
parent
e9a1642521
commit
7803242588
@ -33,11 +33,35 @@ func (o *Orders) sendOrder(order *dbmapping.Order) string {
|
|||||||
if !ok {
|
if !ok {
|
||||||
return "fail"
|
return "fail"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Adding Bastion chat as it's the zero chat
|
||||||
|
bastionGroupID, _ := strconv.ParseInt(c.Cfg.SpecialChats.BastionID, 10, 64)
|
||||||
|
bastionChat := dbmapping.Chat{}
|
||||||
|
err := c.Db.Get(&bastionChat, c.Db.Rebind("SELECT * FROM chats WHERE telegram_id=?"), bastionGroupID)
|
||||||
|
if err != nil {
|
||||||
|
return "fail"
|
||||||
|
}
|
||||||
|
|
||||||
|
targetChats = append(targetChats, bastionChat)
|
||||||
} else {
|
} else {
|
||||||
targetChats, ok = c.Squader.GetSquadChatsBySquadsIDs(order.TargetSquads)
|
targetChats, ok = c.Squader.GetSquadChatsBySquadsIDs(order.TargetSquads)
|
||||||
if !ok {
|
if !ok {
|
||||||
return "fail"
|
return "fail"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
targetChatsIDs := strings.Split(order.TargetSquads, ",")
|
||||||
|
for i := range targetChatsIDs {
|
||||||
|
if targetChatsIDs[i] == "0" {
|
||||||
|
bastionGroupID, _ := strconv.ParseInt(c.Cfg.SpecialChats.BastionID, 10, 64)
|
||||||
|
bastionChat := dbmapping.Chat{}
|
||||||
|
err := c.Db.Get(&bastionChat, c.Db.Rebind("SELECT * FROM chats WHERE telegram_id=?"), bastionGroupID)
|
||||||
|
if err != nil {
|
||||||
|
return "fail"
|
||||||
|
}
|
||||||
|
|
||||||
|
targetChats = append(targetChats, bastionChat)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for i := range targetChats {
|
for i := range targetChats {
|
||||||
|
Reference in New Issue
Block a user