commit - 65cfbeaa871be4faad6419479871592e85ac0bfe
commit + 55346083822c94a90932c1875d96ba4393d9b3ab
blob - /dev/null
blob + 1f05761c106e263bb228ca786192fd61538ca445 (mode 644)
--- /dev/null
+++ Makefile
+GO=go
+SOURCES=$(wildcard *.go)
+BIN=discord_covid19
+
+default: build
+
+all: clean build
+
+clean:
+ rm -rf $(BIN)
+
+build: $(BIN)
+
+fmt:
+ $(GO) fmt $(SOURCESE)
+
+tidy:
+ $(GO) mod tidy
+
+$(BIN): $(SOURCES)
+ $(GO) build -o $@
blob - f7f68c0739ee745d3dcb9321b7bd0b9fd7ed64fb
blob + a8198d818e12232dd73cccb00cd506b4bde8d345
--- main.go
+++ main.go
"os/signal"
"syscall"
- log "github.com/sirupsen/logrus"
"github.com/bwmarrin/discordgo"
+ log "github.com/sirupsen/logrus"
)
const districtEnd = "districts/"
var coronaChannelID string
-// make this global so gocron can call a function without no arguments to print information
var discord *discordgo.Session
func main() {
}
}
log.Infof("Added districts: %+v", ParsedArgs.Districts)
+
// initialize moderators
AddModerators(ParsedArgs.ModeratorIds)
discord, err := discordgo.New("Bot " + ParsedArgs.Token)
+ if err != nil {
+ log.Fatalf("error creating bot: %v", err)
+ }
// Cleanly close down the Discord session on program end
defer discord.Close()
- if err != nil {
- log.Fatalf("error creating bot: %v", err)
- }
InitDiscordBot(discord)
- discord.Identify.Intents = discordgo.IntentsGuildMessages
+ discord.Identify.Intents = discordgo.IntentsGuildMessages | discordgo.IntentsGuildMessageReactions
err = discord.Open()
if err != nil {