mirror of
https://github.com/statbate/special-pancake.git
synced 2026-08-11 03:12:42 +00:00
update
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
This commit is contained in:
parent
6b2e15c947
commit
08dcc14629
1 changed files with 17 additions and 11 deletions
|
|
@ -23,13 +23,13 @@ type Input struct {
|
||||||
type TipMsg struct {
|
type TipMsg struct {
|
||||||
Channel string `json:"channel"`
|
Channel string `json:"channel"`
|
||||||
Messages []struct {
|
Messages []struct {
|
||||||
Name string `json:"name"`
|
Data string `json:"data"`
|
||||||
Amount int64 `json:"amount"`
|
|
||||||
From string `json:"from_username"`
|
|
||||||
} `json:"messages"`
|
} `json:"messages"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type Donate struct {
|
type Donate struct {
|
||||||
|
Name string `json:"name"`
|
||||||
|
From string `json:"from_username"`
|
||||||
Amount int64 `json:"amount"`
|
Amount int64 `json:"amount"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -295,21 +295,27 @@ func statRoom(room, server string, _ url.URL) {
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
donate := &TipMsg{}
|
tipMsg := &TipMsg{}
|
||||||
|
|
||||||
timeout = time.Now().Unix() + 60*60
|
timeout = time.Now().Unix() + 60*60
|
||||||
|
|
||||||
if err := json.Unmarshal([]byte(m), &donate); err != nil {
|
if err := json.Unmarshal([]byte(m), tipMsg); err != nil {
|
||||||
fmt.Println(err.Error())
|
fmt.Println(err.Error())
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
fmt.Printf("donate %#+v\n", donate)
|
// fmt.Printf("msg %s\n", m)
|
||||||
if donate.Channel != "room:tip_alert:"+room_uid {
|
|
||||||
|
if tipMsg.Channel != "room:tip_alert:"+room_uid {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
for _, msg := range donate.Messages {
|
for _, msg := range tipMsg.Messages {
|
||||||
if len(msg.From) > 3 {
|
donate := &Donate{}
|
||||||
fmt.Println(msg.From, " send ", msg.Amount, "tokens")
|
if err := json.Unmarshal([]byte(msg.Data), donate); err != nil {
|
||||||
|
fmt.Println(err.Error())
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
if len(donate.From) > 3 {
|
||||||
|
fmt.Println(donate.From, " send ", donate.Amount, "tokens")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue