manual timetable update with !update
This commit is contained in:
parent
b3628700ae
commit
110e4a5104
1 changed files with 8 additions and 2 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Reference in a new issue