add ingame msg
This commit is contained in:
16
ttd.go
16
ttd.go
@@ -608,10 +608,22 @@ func (s *ServerTTD) ComputeClientTime() {
|
||||
for _, cc := range cfg.Clients {
|
||||
if cc.Online {
|
||||
if cc.TimeLeft > 0 && cc.TimeLeft < diff {
|
||||
bot.SendChat(cfg.Telegram.ChatID, fmt.Sprintf("@%s got not time left. Grace period of %s.", cc.Username, cfg.Game.Threshold))
|
||||
msg := fmt.Sprintf("@%s got not time left. Grace period of %s.", cc.Username, cfg.Game.Threshold)
|
||||
bot.SendChat(cfg.Telegram.ChatID, msg)
|
||||
px := PacketAdminRCon{
|
||||
Packet: Packet{PType: AdminPacketAdminRCon},
|
||||
Command: fmt.Sprintf("say %s", msg),
|
||||
}
|
||||
srv.Send(px.Bytes())
|
||||
}
|
||||
if (cc.TimeLeft+cfg.Game.Threshold) > 0 && (cc.TimeLeft+cfg.Game.Threshold) < diff {
|
||||
bot.SendChat(cfg.Telegram.ChatID, fmt.Sprintf("@%s got not time left. Grace period over.", cc.Username))
|
||||
msg := fmt.Sprintf("@%s got not time left. Grace period over.", cc.Username)
|
||||
bot.SendChat(cfg.Telegram.ChatID, msg)
|
||||
px := PacketAdminRCon{
|
||||
Packet: Packet{PType: AdminPacketAdminRCon},
|
||||
Command: fmt.Sprintf("say %s", msg),
|
||||
}
|
||||
srv.Send(px.Bytes())
|
||||
}
|
||||
cc.TimeLeft = cc.TimeLeft - diff
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user