サーモンラン情報追加
This commit is contained in:
32
main.go
32
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)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user