From a60bbbf0d3c62773669491d158179efe80637425 Mon Sep 17 00:00:00 2001 From: "Gustavo \"Guz\" L. de Mello" Date: Tue, 6 Aug 2024 13:48:37 -0300 Subject: [PATCH] feat: setup discord bot --- .example.env | 1 + docker-compose.yml | 1 + main.go | 12 +++++++++++- 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/.example.env b/.example.env index e69de29..f06aa5a 100644 --- a/.example.env +++ b/.example.env @@ -0,0 +1 @@ +DISCORD_TOKEN=************************************************************************ diff --git a/docker-compose.yml b/docker-compose.yml index 8fd4754..29c90af 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -7,6 +7,7 @@ services: - dislate ports: - 8080:8080 + env_file: .env networks: dislate: diff --git a/main.go b/main.go index 3ce4163..9c99677 100644 --- a/main.go +++ b/main.go @@ -2,10 +2,20 @@ package main import ( "log" + "os" - _ "github.com/bwmarrin/discordgo" + "github.com/bwmarrin/discordgo" ) func main() { log.Printf("Hello, world") + + discord, err := discordgo.New("Bot " + os.Getenv("DISCORD_TOKEN")) + if err != nil { + panic(err) + } + err = discord.Open() + if err != nil { + panic(err) + } }