mirror of
https://github.com/cjdenio/jia.git
synced 2024-11-22 07:33:39 +00:00
Properly truncate event entries
This commit is contained in:
parent
2903509a87
commit
6e6e688be4
1 changed files with 4 additions and 3 deletions
|
@ -216,6 +216,10 @@ func HandleEventsSlashCommand(w http.ResponseWriter, r *http.Request) {
|
|||
return entries[i].Number > entries[j].Number
|
||||
})
|
||||
|
||||
if len(entries) > 10 {
|
||||
entries = entries[:10]
|
||||
}
|
||||
|
||||
for i, v := range entries {
|
||||
emoji := ""
|
||||
if i == 0 {
|
||||
|
@ -229,9 +233,6 @@ func HandleEventsSlashCommand(w http.ResponseWriter, r *http.Request) {
|
|||
blocks = append(blocks, slack.NewSectionBlock(slack.NewTextBlockObject("mrkdwn", fmt.Sprintf("%s <@%s> has counted *%d* so far", emoji, v.User, v.Number), false, false), nil, nil))
|
||||
}
|
||||
|
||||
if len(entries) > 10 {
|
||||
entries = entries[:10]
|
||||
}
|
||||
blocks = append(blocks, slack.NewContextBlock("", slack.NewTextBlockObject("mrkdwn", fmt.Sprintf("Event will end at *<!date^%d^{time} on {date}|some date>*, your time", events[0].EndTime.Unix()), false, false)))
|
||||
} else {
|
||||
blocks = append(blocks, slack.NewSectionBlock(slack.NewTextBlockObject("mrkdwn", "Something went wrong fetching the events leaderboard :cry:", false, false), nil, nil))
|
||||
|
|
Loading…
Reference in a new issue