first commit

This commit is contained in:
Space-Banane
2026-01-21 22:55:58 +01:00
commit 66cf67d389
12 changed files with 788 additions and 0 deletions

35
commands/logout.go Normal file
View File

@@ -0,0 +1,35 @@
package commands
import (
"github.com/bwmarrin/discordgo"
)
func newLogoutCommand() *Cmd {
return &Cmd{
Command: &discordgo.ApplicationCommand{
Name: "logout",
Description: "Remove your stored Thoughtful credentials",
},
Handler: handleLogout,
}
}
func handleLogout(s *discordgo.Session, ic *discordgo.InteractionCreate) {
user := ic.User
if user == nil {
user = ic.Member.User
}
err := DeleteUserConfig(user.ID)
content := "Your credentials have been removed."
if err != nil {
content = "Error removing credentials: " + err.Error()
}
s.InteractionRespond(ic.Interaction, &discordgo.InteractionResponse{
Type: discordgo.InteractionResponseChannelMessageWithSource,
Data: &discordgo.InteractionResponseData{
Content: content,
Flags: discordgo.MessageFlagsEphemeral,
},
})
}