Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

43 add config value for which branch to pull updates for update #116

Merged
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
20 changes: 1 addition & 19 deletions commands/slash/update.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import (

"github.com/bwmarrin/discordgo"
"github.com/ritsec/ops-bot-iii/commands/slash/permission"
"github.com/ritsec/ops-bot-iii/config"
"github.com/ritsec/ops-bot-iii/helpers"
"github.com/ritsec/ops-bot-iii/logging"
"github.com/sirupsen/logrus"
Expand Down Expand Up @@ -47,7 +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)
logging.Debug(s, debugMessage, i.Member.User, span)
logging.Info(s, debugMessage, i.Member.User, span)

var update bool
var err error
Expand All @@ -59,23 +58,6 @@ func Update() (*discordgo.ApplicationCommand, func(s *discordgo.Session, i *disc
return
}
} else {
// Soft lock the main server to main branch
// TODO change the id to main server id before merging
if config.GuildID == "1073013590702964856" {
logging.Warning(s, "Branch config option used with /update", i.Member.User, span)
err = s.InteractionRespond(i.Interaction, &discordgo.InteractionResponse{
Type: discordgo.InteractionResponseChannelMessageWithSource,
Data: &discordgo.InteractionResponseData{
Content: "Cannot use the branch config option on the main server",
Flags: discordgo.MessageFlagsEphemeral,
},
})
if err != nil {
logging.Error(s, "Error responding to interaction", i.Member.User, span, logrus.Fields{"err": err.Error()})
return
}
return
}
update, err = helpers.UpdateRemoteBranch(branch)
if err != nil {
logging.Error(s, "Error updating remote branch", i.Member.User, span, logrus.Fields{"err": err.Error()})
Expand Down
Loading