This commit is contained in:
poiuty 2023-05-11 14:30:47 +03:00
parent f2970c325c
commit d42503ad10
5 changed files with 31 additions and 104 deletions

View file

@ -131,16 +131,18 @@ func saveDB() {
if m.Amount > 49 {
msg, err := json.Marshal(struct {
Chanel string `json:"chanel"`
Room string `json:"room"`
Donator string `json:"donator"`
Amount int64 `json:"amount"`
}{
Chanel: "stripchat",
Room: m.Room,
Donator: m.From,
Amount: m.Amount,
})
if err == nil {
ws.Send <- msg
socketServer <- msg
}
}
@ -154,10 +156,14 @@ func saveDB() {
if minutes >= 5 && now > index["last"]+30 {
seconds += minutes * 60
msg, err := json.Marshal(struct {
Chanel string `json:"chanel"`
Index float64 `json:"index"`
}{Index: float64(index["tokens"]) / float64(seconds) * 3600 * 0.05 / 1000})
}{
Chanel: "stripchat",
Index: float64(index["tokens"]) / float64(seconds) * 3600 * 0.05 / 1000,
})
if err == nil {
ws.Send <- msg
socketServer <- msg
}
index["last"] = now
}