Compare commits

..

No commits in common. "658db4d0517d756a28e3d77c0b0f7ac1f0bdb135" and "09c2ae06dcecbda9b2cad6e0a358466f3ae99def" have entirely different histories.

4 changed files with 14 additions and 32 deletions

View File

@ -89,11 +89,6 @@ func (c *VerifyCommand) Exec(ctx shireikan.Context) error {
code := uuid.New().String() 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()) err = SendEmail([]string{email}, code, ctx.GetUser())
if err != nil { if err != nil {
@ -103,10 +98,9 @@ func (c *VerifyCommand) Exec(ctx shireikan.Context) error {
// expires in 5 minutes // expires in 5 minutes
expires := time.Now().Add(time.Minute * 5) expires := time.Now().Add(time.Minute * 5)
ctx.GetSession().ChannelMessageEditComplex(&discordgo.MessageEdit{ m, err := ctx.GetSession().ChannelMessageSendComplex(ctx.GetChannel().ID, &discordgo.MessageSend{
ID: m.ID, Reference: ctx.GetMessage().Reference(),
Channel: ctx.GetChannel().ID, Embed: embed.NewSuccessEmbed(ctx).SetTitle("Sent Verification Email").SetDescription("Waiting for you to verify...").AddField("Expires", fmt.Sprintf("<t:%d:R>", expires.Unix()), false).MessageEmbed,
Embed: embed.NewSuccessEmbed(ctx).SetTitle("Sent Verification Email").SetDescription("Waiting for you to verify...\n\n**Make sure to check your spam folder!**").AddField("Expires", fmt.Sprintf("<t:%d:R>", expires.Unix()), false).MessageEmbed,
}) })
if err != nil { if err != nil {
@ -225,21 +219,13 @@ func SendEmail(to []string, code string, discordUser *discordgo.User) error {
buf := new(bytes.Buffer) buf := new(bytes.Buffer)
data := struct { err = tmpl.Execute(buf, struct {
Code string Code string
DiscordUserName string DiscordUserName string
BaseUrl string
}{ }{
Code: code, Code: code,
DiscordUserName: discordUser.Username, 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 { if err != nil {
return err return err

View File

@ -17,7 +17,7 @@ var (
var ( var (
// BotPrefix is the prefix used for bot commands. // BotPrefix is the prefix used for bot commands.
BotPrefix = "!" BotPrefix = ">>"
// BotGuild is the ID of the guild the bot is running on. // BotGuild is the ID of the guild the bot is running on.
BotGuild = "936651575684915201" BotGuild = "936651575684915201"

14
main.go
View File

@ -22,8 +22,6 @@ import (
) )
func main() { func main() {
log.Info(os.Environ())
token := os.Getenv("TOKEN") token := os.Getenv("TOKEN")
session, err := discordgo.New("Bot " + token) session, err := discordgo.New("Bot " + token)
@ -162,15 +160,13 @@ func main() {
log.Fatal(err) log.Fatal(err)
} }
if os.Getenv("ENV") != "development" { log.Info("Starting daily menu job...")
log.Info("Starting daily menu job...")
s.Start() s.Start()
err = dcMenuJob.RunNow() err = dcMenuJob.RunNow()
if err != nil { if err != nil {
log.Fatal(err) log.Fatal(err)
}
} }
} }

View File

@ -28,16 +28,16 @@
<div class="mt-4"> <div class="mt-4">
<a <a
class="px-2 py-2 text-white bg-blue-600 rounded-md font-semibold" class="px-2 py-2 text-white bg-blue-600 rounded-md font-semibold"
href="{{ .BaseUrl }}/verify?code={{ .Code }}" href="https://hampbot.fly.dev/verify?code={{ .Code }}"
>Click to Verify Email</a >Click to Verify Email</a
> >
<p class="mt-4 text-sm"> <p class="mt-4 text-sm">
If you're having trouble clicking the "Verify Email Address" button, If you're having trouble clicking the "Verify Email Address" button,
copy and paste the URL below into your web browser: copy and paste the URL below into your web browser:
<a <a
href="{{ .BaseUrl }}/verify?code={{ .Code }}" href="https://hampbot.fly.dev/verify?code={{ .Code }}"
class="text-blue-600" class="text-blue-600"
>{{ .BaseUrl }}/verify?code={{ .Code }}</a >https://hampbot.fly.dev/verify?code={{ .Code }}</a
> >
</p> </p>
</div> </div>