delete unused
This commit is contained in:
parent
f05157916d
commit
6c07bd9d13
1 changed files with 0 additions and 54 deletions
54
main.go
54
main.go
|
|
@ -574,57 +574,3 @@ func sendUpdateDiscordWebhookWithDetails(changes []string) {
|
|||
log.Printf("Discord webhook failed with status %d: %s", resp.StatusCode, string(body))
|
||||
}
|
||||
}
|
||||
|
||||
func sendUpdateDiscordWebhook() {
|
||||
log.Println("Sending Discord webhook notification...")
|
||||
// Create a rich embed message
|
||||
message := "A lesson on your timetable has changed"
|
||||
/*embed := Embed{
|
||||
Title: "Next Lesson ",
|
||||
Description: "The next lesson is starting soon: ",
|
||||
Color: 3066993, // Green color
|
||||
Timestamp: time.Now().Format(time.RFC3339),
|
||||
Fields: []Field{
|
||||
{
|
||||
Name: "New Lesson",
|
||||
// Value: fmt.Sprintf("`%s`", ip),
|
||||
Value: fmt.Sprintf("Room: %s", room),
|
||||
Inline: true,
|
||||
},
|
||||
{
|
||||
Name: "Start-Time",
|
||||
Value: fmt.Sprintf("Start time: %s", nextTime),
|
||||
Inline: true,
|
||||
},
|
||||
{
|
||||
Name: "Status",
|
||||
Value: fmt.Sprintf("Status: %s", Status),
|
||||
Inline: true,
|
||||
},
|
||||
},
|
||||
}
|
||||
*/
|
||||
payload := DiscordWebhookPayload{
|
||||
Content: message,
|
||||
}
|
||||
|
||||
jsonData, err := json.Marshal(payload)
|
||||
if err != nil {
|
||||
log.Printf("Error marshaling webhook payload: %v", err)
|
||||
return
|
||||
}
|
||||
|
||||
resp, err := http.Post(discordWebhookURL, "application/json", bytes.NewBuffer(jsonData))
|
||||
if err != nil {
|
||||
log.Printf("Error sending Discord webhook: %v", err)
|
||||
return
|
||||
}
|
||||
defer resp.Body.Close()
|
||||
|
||||
if resp.StatusCode >= 200 && resp.StatusCode < 300 {
|
||||
log.Println("Discord webhook notification sent successfully")
|
||||
} else {
|
||||
body, _ := ioutil.ReadAll(resp.Body)
|
||||
log.Printf("Discord webhook failed with status %d: %s", resp.StatusCode, string(body))
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue