From 075d2c25acf1408c242692d2a933daf9ffec9f0a Mon Sep 17 00:00:00 2001 From: Maxwell Date: Wed, 13 Dec 2023 05:33:34 +0000 Subject: [PATCH] rebuild config to have extra url to prevent bootloop --- commands/slash/vote.go | 7 ++++++- config/main.go | 1 - config_example.yml | 2 ++ structs/webConfig.go | 3 --- 4 files changed, 8 insertions(+), 5 deletions(-) diff --git a/commands/slash/vote.go b/commands/slash/vote.go index dd1b551..c8a55af 100644 --- a/commands/slash/vote.go +++ b/commands/slash/vote.go @@ -17,6 +17,11 @@ import ( "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/tracer" ) +var ( + // VoteURL is the URL for the vote page + VoteURL = config.GetString("vote.url") +) + // Vote is a slash command that creates a vote func Vote() (*discordgo.ApplicationCommand, func(s *discordgo.Session, i *discordgo.InteractionCreate)) { return &discordgo.ApplicationCommand{ @@ -264,7 +269,7 @@ func Vote() (*discordgo.ApplicationCommand, func(s *discordgo.Session, i *discor return } - out := "```\n" + entVoteResults.Plain + "\n```" + "\nResults Graph:\n" + config.Web.Protocol + "://" + config.Web.Hostname + ":" + config.Web.Port + "/vote/" + voteSlug + "\n" + out := "```\n" + entVoteResults.Plain + "\n```" + "\nResults Graph:\n" + VoteURL + "/vote/" + voteSlug + "\n" _, err = s.InteractionResponseEdit(i.Interaction, &discordgo.WebhookEdit{ Content: &out, diff --git a/config/main.go b/config/main.go index c6990d7..2e9cae4 100644 --- a/config/main.go +++ b/config/main.go @@ -74,7 +74,6 @@ 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/config_example.yml b/config_example.yml index d2e5593..f8001cf 100644 --- a/config_example.yml +++ b/config_example.yml @@ -48,4 +48,6 @@ commands: prospective_role_id: staff_role_id: alumni_role_id: + vote: + url: http(s)://example.com \ No newline at end of file diff --git a/structs/webConfig.go b/structs/webConfig.go index 8e2f9c0..88bfc03 100644 --- a/structs/webConfig.go +++ b/structs/webConfig.go @@ -7,7 +7,4 @@ type WebConfig struct { // Hostname is the hostname to listen on Hostname string - - // Protocol is the protocol to use - Protocol string }