Skip to content

Commit

Permalink
chore: daily notify の文面を調整
Browse files Browse the repository at this point in the history
  • Loading branch information
Takeno-hito committed Oct 3, 2023
1 parent ade147a commit 8f38c3a
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions utils/cron.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,10 @@ func InitPostEventToTraQ(repo *db.GormRepository, secret, channelID, webhookID,
rooms, _ := repo.GetAllRooms(now, tomorrow, uuid.Nil)
events, _ := repo.GetAllEvents(filter.FilterTime(now, tomorrow))
message := createMessage(now, rooms, events, origin)
_ = RequestWebhook(message, secret, channelID, webhookID, 1)
err := RequestWebhook(message, secret, channelID, webhookID, 1)
if err != nil {
fmt.Println(err)
}
}

return job
Expand Down Expand Up @@ -106,7 +109,7 @@ func createMessage(t time.Time, rooms []*domain.Room, events []*db.Event, origin
var verifiedRoomNames []string

if len(rooms) == 0 {
roomMessage = fmt.Sprintf("%sの進捗部屋は、予約を取っていないようです\n", date)
roomMessage = fmt.Sprintf("本日は予約を取っていないようです\n")

Check failure on line 112 in utils/cron.go

View workflow job for this annotation

GitHub Actions / Lint

S1039: unnecessary use of fmt.Sprintf (gosimple)
} else {
for _, room := range rooms {
if room.Verified && !slices.Contains(verifiedRoomNames, room.Place) {
Expand All @@ -115,7 +118,7 @@ func createMessage(t time.Time, rooms []*domain.Room, events []*db.Event, origin
}

if len(verifiedRoomNames) == 0 {
roomMessage = fmt.Sprintf("%sの進捗部屋は、予約を取っていないようです\n", date)
roomMessage = fmt.Sprintf("本日は予約を取っていないようです\n")

Check failure on line 121 in utils/cron.go

View workflow job for this annotation

GitHub Actions / Lint

S1039: unnecessary use of fmt.Sprintf (gosimple)
} else {
timeTables := []timeTable{
{":sunny:", setTimeFromString(t, "00:00:00"), false},
Expand Down Expand Up @@ -166,5 +169,7 @@ func createMessage(t time.Time, rooms []*domain.Room, events []*db.Event, origin
}

}
return roomMessage + eventMessage

message := fmt.Sprintf("## %s の進捗部屋\n%s## %s 開催予定のイベント\n%s", date, roomMessage, date, eventMessage)
return message
}

0 comments on commit 8f38c3a

Please sign in to comment.