diff --git a/.env-example b/.env-example index 09a0196..735d187 100644 --- a/.env-example +++ b/.env-example @@ -3,3 +3,4 @@ DISCORD_TOKEN= PUBLIC_KEY= FANSLY_TOKEN= USER_AGENT= +LOG_CHANNEL_ID= diff --git a/internal/bot/handlers.go b/internal/bot/handlers.go index 52883fe..a4a7099 100644 --- a/internal/bot/handlers.go +++ b/internal/bot/handlers.go @@ -7,6 +7,7 @@ import ( "time" "github.com/bwmarrin/discordgo" + "github.com/fvckgrimm/discord-fansly-notify/internal/config" ) func (b *Bot) ready(s *discordgo.Session, event *discordgo.Ready) { @@ -46,6 +47,18 @@ func (b *Bot) handleAddCommand(s *discordgo.Session, i *discordgo.InteractionCre } } + // Log What Creators are being monitored to better handle potential issues + logMessage := fmt.Sprintf("`[ %s ]` %s:\n`Requested Creator Name:` **%s**\n----------", + time.Now().Format("2006-01-02 15:04:05"), + i.Member.User.Username, + username, + ) + + _, err := s.ChannelMessageSend(config.LogChannelID, logMessage) + if err != nil { + log.Printf("Failed to send log message: %v", err) + } + accountInfo, err := b.APIClient.GetAccountInfo(username) if err != nil { log.Printf("Error getting account info for %s: %v", username, err) diff --git a/internal/config/config.go b/internal/config/config.go index 240d8e0..bbcd0d4 100644 --- a/internal/config/config.go +++ b/internal/config/config.go @@ -13,6 +13,7 @@ var ( UserAgent string AppID string PublicKey string + LogChannelID string ) func Load() { @@ -26,8 +27,9 @@ func Load() { UserAgent = os.Getenv("USER_AGENT") AppID = os.Getenv("APP_ID") PublicKey = os.Getenv("PUBLIC_KEY") + LogChannelID = os.Getenv("LOG_CHANNEL_ID") - if DiscordToken == "" || FanslyToken == "" || UserAgent == "" || AppID == "" || PublicKey == "" { + if DiscordToken == "" || FanslyToken == "" || UserAgent == "" || AppID == "" || PublicKey == "" || LogChannelID == "" { log.Fatal("Missing required environment variables") } }