From 618b101093c059f9de772af95feef8bc480b6312 Mon Sep 17 00:00:00 2001 From: sirrow Date: Wed, 28 May 2025 19:25:32 +0900 Subject: [PATCH] =?UTF-8?q?=E3=82=B5=E3=83=BC=E3=83=A2=E3=83=B3=E3=83=A9?= =?UTF-8?q?=E3=83=B3=E6=83=85=E5=A0=B1=E8=BF=BD=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- main.go | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) 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)