diff --git a/internal/commands/util/verify.go b/internal/commands/util/verify.go index aa01da1..9f5bc47 100644 --- a/internal/commands/util/verify.go +++ b/internal/commands/util/verify.go @@ -89,6 +89,11 @@ func (c *VerifyCommand) Exec(ctx shireikan.Context) error { code := uuid.New().String() + m, err := ctx.GetSession().ChannelMessageSendComplex(ctx.GetChannel().ID, &discordgo.MessageSend{ + Reference: ctx.GetMessage().Reference(), + Embed: embed.NewWarningEmbed(ctx).SetTitle("Sending Verification Email").SetDescription("Please wait...").MessageEmbed, + }) + err = SendEmail([]string{email}, code, ctx.GetUser()) if err != nil { @@ -98,9 +103,10 @@ func (c *VerifyCommand) Exec(ctx shireikan.Context) error { // expires in 5 minutes expires := time.Now().Add(time.Minute * 5) - m, err := ctx.GetSession().ChannelMessageSendComplex(ctx.GetChannel().ID, &discordgo.MessageSend{ - Reference: ctx.GetMessage().Reference(), - Embed: embed.NewSuccessEmbed(ctx).SetTitle("Sent Verification Email").SetDescription("Waiting for you to verify...").AddField("Expires", fmt.Sprintf("", expires.Unix()), false).MessageEmbed, + ctx.GetSession().ChannelMessageEditComplex(&discordgo.MessageEdit{ + ID: m.ID, + Channel: ctx.GetChannel().ID, + Embed: embed.NewSuccessEmbed(ctx).SetTitle("Sent Verification Email").SetDescription("Waiting for you to verify...").AddField("Expires", fmt.Sprintf("", expires.Unix()), false).MessageEmbed, }) if err != nil { @@ -219,13 +225,21 @@ func SendEmail(to []string, code string, discordUser *discordgo.User) error { buf := new(bytes.Buffer) - err = tmpl.Execute(buf, struct { + data := struct { Code string DiscordUserName string + BaseUrl string }{ Code: code, DiscordUserName: discordUser.Username, - }) + BaseUrl: "http://localhost:8080", + } + + if os.Getenv("ENV") != "development" { + data.BaseUrl = "https://hampbot.fly.dev" + } + + err = tmpl.Execute(buf, data) if err != nil { return err diff --git a/internal/utils/config/config.go b/internal/utils/config/config.go index a65fc35..f856a77 100644 --- a/internal/utils/config/config.go +++ b/internal/utils/config/config.go @@ -17,7 +17,7 @@ var ( var ( // BotPrefix is the prefix used for bot commands. - BotPrefix = ">>" + BotPrefix = "!" // BotGuild is the ID of the guild the bot is running on. BotGuild = "936651575684915201" diff --git a/main.go b/main.go index e4949cb..91634a7 100644 --- a/main.go +++ b/main.go @@ -22,6 +22,8 @@ import ( ) func main() { + log.Info(os.Environ()) + token := os.Getenv("TOKEN") session, err := discordgo.New("Bot " + token) @@ -160,13 +162,15 @@ func main() { log.Fatal(err) } - log.Info("Starting daily menu job...") + if os.Getenv("ENV") != "development" { + log.Info("Starting daily menu job...") - s.Start() + s.Start() - err = dcMenuJob.RunNow() + err = dcMenuJob.RunNow() - if err != nil { - log.Fatal(err) + if err != nil { + log.Fatal(err) + } } } diff --git a/verify.html b/verify.html index 5d4c3c7..018dbb8 100644 --- a/verify.html +++ b/verify.html @@ -28,16 +28,16 @@
Click to Verify Email

If you're having trouble clicking the "Verify Email Address" button, copy and paste the URL below into your web browser: https://hampbot.fly.dev/verify?code={{ .Code }}{{ .BaseUrl }}/verify?code={{ .Code }}