Skip to content

Commit

Permalink
debugging
Browse files Browse the repository at this point in the history
  • Loading branch information
c0untingNumbers committed May 13, 2024
1 parent bcfea48 commit 2947eee
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
4 changes: 3 additions & 1 deletion commands/slash/update.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ func Update() (*discordgo.ApplicationCommand, func(s *discordgo.Session, i *disc
}

debugMessage := fmt.Sprintf("Update command received with options: force=%v, branch=%s", force, branch)
//TODO Change it to Debug
logging.Info(s, debugMessage, i.Member.User, span)

var update bool
Expand All @@ -58,7 +59,8 @@ func Update() (*discordgo.ApplicationCommand, func(s *discordgo.Session, i *disc
return
}
} else {
update, err = helpers.UpdateRemoteBranch(branch)
// TODO REMOVE THE EXTRA PARAMETERS
update, err = helpers.UpdateRemoteBranch(branch, span, s, i)
if err != nil {
logging.Error(s, "Error updating remote branch", i.Member.User, span, logrus.Fields{"err": err.Error()})
return
Expand Down
9 changes: 8 additions & 1 deletion helpers/update.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ import (
"bytes"
"fmt"
"os/exec"

"github.com/bwmarrin/discordgo"
"github.com/ritsec/ops-bot-iii/logging"
"gopkg.in/DataDog/dd-trace-go.v1/ddtrace"
)

// UpdateMainBranch switches to the main branch, fetches from origin, pulls from origin, and returns true if an update was pulled
Expand Down Expand Up @@ -59,7 +63,10 @@ func UpdateMainBranch() (bool, error) {
}

// UpdateRemoteBranch switches to the remote branch, fetches from origin, pulls from origin, and returns true if an update was pulled
func UpdateRemoteBranch(branch string) (bool, error) {
// TODO REMOVE THE EXTRA PARAMETERS
func UpdateRemoteBranch(branch string, span ddtrace.Span, s *discordgo.Session, i *discordgo.InteractionCreate) (bool, error) {
// TODO REMOVE THIS
logging.Info(s, "It ran :D", i.Member.User, span)
switchCmd := exec.Command("git", "switch", branch)

stderr := &bytes.Buffer{}
Expand Down

0 comments on commit 2947eee

Please sign in to comment.