From 144fc9663c0fb65369233e71a61cef160a0325e5 Mon Sep 17 00:00:00 2001 From: Maxwell Date: Fri, 8 Sep 2023 18:25:53 +0000 Subject: [PATCH] general meetings now have 4 hours delay --- commands/slash/signin.go | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/commands/slash/signin.go b/commands/slash/signin.go index 82f4dd1..9c5cfec 100644 --- a/commands/slash/signin.go +++ b/commands/slash/signin.go @@ -195,8 +195,15 @@ func Signin() *structs.SlashCommand { } defer delete(*ComponentHandlers, signinSlug) + var delay int + if signinType == "General Meeting" { + delay = 4 + } else { + delay = 2 + } + message, err := s.ChannelMessageSendComplex(i.ChannelID, &discordgo.MessageSend{ - Content: "Signins are open for **" + signinType + "** until **" + time.Now().In(location).Add(2*time.Hour).Format("3:04PM") + "**!", + Content: "Signins are open for **" + signinType + "** until **" + time.Now().In(location).Add(time.Duration(delay)*time.Hour).Format("3:04PM") + "**!", Components: []discordgo.MessageComponent{ discordgo.ActionsRow{ Components: []discordgo.MessageComponent{ @@ -216,7 +223,7 @@ func Signin() *structs.SlashCommand { err = s.InteractionRespond(i.Interaction, &discordgo.InteractionResponse{ Type: discordgo.InteractionResponseChannelMessageWithSource, Data: &discordgo.InteractionResponseData{ - Content: "Signin Message Created, it will close in 2 hours!", + Content: fmt.Sprintf("Signin Message Created, it will close in %d hours!", delay), Flags: discordgo.MessageFlagsEphemeral, }, }) @@ -224,7 +231,7 @@ func Signin() *structs.SlashCommand { logging.Error(s, err.Error(), i.Member.User, span, logrus.Fields{"error": err}) } - time.Sleep(2 * time.Hour) + time.Sleep(time.Duration(delay) * time.Hour) err = s.ChannelMessageDelete(i.ChannelID, message.ID) if err != nil {