From 5eb9013f9d1bf653c041d8e11545f9b7c3759085 Mon Sep 17 00:00:00 2001 From: Malachy Byrne Date: Tue, 1 Apr 2025 16:22:16 +0100 Subject: [PATCH] Publish docker image --- Dockerfile | 14 ++++++++++++++ application/bot.go | 1 - application/commands.go | 2 +- 3 files changed, 15 insertions(+), 2 deletions(-) create mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..6b436d6 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,14 @@ +FROM golang:1.23 +LABEL authors="malmal200" + +WORKDIR /app + +COPY go.mod go.sum ./ +RUN go mod download + +COPY dice/*.go ./dice/ +COPY application/*.go ./application/ + +RUN CGO_ENABLED=0 GOOS=linux go build -o /go-bot ./application + +ENTRYPOINT ["/go-bot"] \ No newline at end of file diff --git a/application/bot.go b/application/bot.go index 81c3bd0..c547062 100644 --- a/application/bot.go +++ b/application/bot.go @@ -14,7 +14,6 @@ var prefix = os.Getenv("COMMAND_PREFIX") func init() { token := os.Getenv("DISCORD_TOKEN") - token = "ODgyNzI5OTg1MzgxNjUwNTEy.GEOiR0.MPRFc10hMG6RKLla4ic-gXP7oTKTFacbAFpapk" var err error s, err = discordgo.New("Bot " + token) if err != nil { diff --git a/application/commands.go b/application/commands.go index d1fd569..a6783fc 100644 --- a/application/commands.go +++ b/application/commands.go @@ -78,7 +78,7 @@ func roll(opts optionMap) string { if err != nil { return fmt.Sprintf("Error rolling dice: %s", err) } - total := 0 + total := d.Add for i, die := range roll { _, err = fmt.Fprintf(&ret, "%v", die.Result) if err != nil {