Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ go.work.sum

# database
*.db
*.aof

# Editor/IDE
# .idea/
Expand Down
24 changes: 22 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,15 @@ all: tidy fmt vet lint test build

.PHONY: run
run:
@echo ">> running $(bin)..."
$(GO) run $(pkg)
@echo ">> running..."
@trap 'kill 0' EXIT; \
bin/jupidis --debug & \
bin/$(bin)

.PHONY: run-bot
run-bot:
@echo ">> running bot..."
bin/$(bin)

.PHONY: build
build:
Expand Down Expand Up @@ -83,3 +90,16 @@ update:
outdated:
@echo ">> checking outdated dependencies..."
@$(GO) list -u -m -json all | $(GO) run golang.org/x/exp/cmd/modoutdated

.PHONY: build-jupidis
build-jupidis:
@echo ">> cloning and building jupidis..."
@TMP_DIR=$$(mktemp -d); \
REPO_URL="https://github.com/nxtgo/jupidis.git"; \
PROJECT_DIR=$$(pwd); \
echo ">> cloning $$REPO_URL"; \
git clone --depth=1 $$REPO_URL $$TMP_DIR >/dev/null; \
echo ">> building binary..."; \
mkdir -p $$PROJECT_DIR/bin; \
cd $$TMP_DIR && go build -o $$PROJECT_DIR/bin/jupidis; \
rm -rf $$TMP_DIR
1 change: 1 addition & 0 deletions cmd/bot/register.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@ import (
_ "first.fm/internal/commands/profile"
_ "first.fm/internal/commands/register"
_ "first.fm/internal/commands/stats"
_ "first.fm/internal/commands/whoknows"
)
2 changes: 1 addition & 1 deletion internal/bot/bot.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,9 @@ func (b *Bot) Run(ctx context.Context) error {
defer b.Client.Close(ctx)

if _, err := b.Client.Rest.SetGuildCommands(b.Client.ApplicationID, snowflake.GetEnv("GUILD_ID"), Commands()); err != nil {
b.Client.Close(ctx)
return err
}
logger.Info("registered discord commands")

stop := make(chan os.Signal, 1)
signal.Notify(stop, os.Interrupt, syscall.SIGTERM)
Expand Down
Loading