diff --git a/main.go b/main.go index cd3763f..80cc852 100644 --- a/main.go +++ b/main.go @@ -220,6 +220,37 @@ func battleSchedule() string { return output } +func salmonRunSchedule() string { + url := "https://spla3.yuu26.com/api/coop-grouping/schedule" + + resp, err := http.Get(url) + if err != nil { + panic(err) + } + defer resp.Body.Close() + + byteArray, _ := io.ReadAll(resp.Body) + var data SalmonRunSchedule + err = json.Unmarshal(byteArray, &data) + if err != nil { + panic(err) + } + + output := "サーモンラン スケジュール\n" + output += "```\n" + for _, v := range data.Results { + output += fmt.Sprintf("%d/%d %2d:%02d- ", v.StartTime.Month(), v.StartTime.Day(), v.StartTime.Hour(), v.StartTime.Minute()) + output += v.Stage.Name + " " + output += v.Boss.Name + "\n " + for _, weapon := range v.Weapons { + output += weapon.Name + " " + } + output += "\n\n" + } + output += "```\n" + return output +} + func main() { discordChannelId := os.Getenv("DISCORD_CHANNEL_ID") discordToken := os.Getenv("DISCORD_TOKEN") @@ -230,6 +261,7 @@ func main() { } output := battleSchedule() + output += salmonRunSchedule() output += "updated at " + time.Now().Format("1/2 15:04") + "\n" print(output)