From 110e4a5104924771c8fe33c160c2d4811c350926 Mon Sep 17 00:00:00 2001 From: Jannover5000r Date: Tue, 20 Jan 2026 09:25:43 +0100 Subject: [PATCH] manual timetable update with !update --- Botrun/BotStart.go | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/Botrun/BotStart.go b/Botrun/BotStart.go index acf7067..7342ab8 100644 --- a/Botrun/BotStart.go +++ b/Botrun/BotStart.go @@ -111,7 +111,7 @@ func saveAccount(userID, username, password string) error { // Ensure the accounts directory exists accountsDir := filepath.Dir(accountsFile) - if err := os.MkdirAll(accountsDir, 0755); err != nil { + if err := os.MkdirAll(accountsDir, 0o755); err != nil { return fmt.Errorf("failed to create accounts directory: %v", err) } @@ -393,7 +393,7 @@ func messageCreate(s *discordgo.Session, m *discordgo.MessageCreate) { return } // Handle "!addaccount" only in guilds (not in DMs) - if m.GuildID != "" && m.Content == "!addaccount" { + if m.Content == "!addaccount" { // Delete the command for privacy _ = s.ChannelMessageDelete(m.ChannelID, m.ID) // Create DM channel @@ -410,6 +410,12 @@ func messageCreate(s *discordgo.Session, m *discordgo.MessageCreate) { return } + if m.Content == "!update" { + _ = s.ChannelMessageDelete(m.ChannelID, m.ID) + checkAllUsersTimetables(DiscordSession) + s.ChannelMessageSend(m.ChannelID, "Updated all Timetables manually") + } + // Handle "!deleteaccount" and "!removeaccount" commands if m.GuildID != "" && (m.Content == "!deleteaccount" || m.Content == "!removeaccount") { // Delete the command message for privacy