From a505114fb55c403475e0eaacd93cae29804ef22e Mon Sep 17 00:00:00 2001 From: Maxwell Date: Wed, 13 Dec 2023 05:18:48 +0000 Subject: [PATCH] implemented protocol for web --- commands/slash/vote.go | 2 +- config/main.go | 1 + structs/webConfig.go | 3 +++ 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/commands/slash/vote.go b/commands/slash/vote.go index cfd7950..dd1b551 100644 --- a/commands/slash/vote.go +++ b/commands/slash/vote.go @@ -264,7 +264,7 @@ func Vote() (*discordgo.ApplicationCommand, func(s *discordgo.Session, i *discor return } - out := "```\n" + entVoteResults.Plain + "\n```" + "\nResults Graph:\nhttp://" + config.Web.Hostname + ":" + config.Web.Port + "/vote/" + voteSlug + "\n" + out := "```\n" + entVoteResults.Plain + "\n```" + "\nResults Graph:\n" + config.Web.Protocol + "://" + config.Web.Hostname + ":" + config.Web.Port + "/vote/" + voteSlug + "\n" _, err = s.InteractionResponseEdit(i.Interaction, &discordgo.WebhookEdit{ Content: &out, diff --git a/config/main.go b/config/main.go index 2e9cae4..c6990d7 100644 --- a/config/main.go +++ b/config/main.go @@ -74,6 +74,7 @@ func web() structs.WebConfig { return structs.WebConfig{ Port: viper.GetString("web.port"), Hostname: viper.GetString("web.hostname"), + Protocol: viper.GetString("web.protocol"), } } diff --git a/structs/webConfig.go b/structs/webConfig.go index 88bfc03..8e2f9c0 100644 --- a/structs/webConfig.go +++ b/structs/webConfig.go @@ -7,4 +7,7 @@ type WebConfig struct { // Hostname is the hostname to listen on Hostname string + + // Protocol is the protocol to use + Protocol string }