|
|
|
@ -14,7 +14,7 @@ var versionString string
|
|
|
|
|
|
|
|
|
|
func handleVersionCommand(s *discordgo.Session, args []string, m *discordgo.MessageCreate) error {
|
|
|
|
|
if versionString == "" {
|
|
|
|
|
out, err := exec.Command("git describe --tags").Output()
|
|
|
|
|
out, err := exec.Command("git", "describe", "--tags").Output()
|
|
|
|
|
if err != nil {
|
|
|
|
|
log.Error(
|
|
|
|
|
s,
|
|
|
|
@ -22,13 +22,20 @@ func handleVersionCommand(s *discordgo.Session, args []string, m *discordgo.Mess
|
|
|
|
|
)
|
|
|
|
|
versionString = "Error while generating version string."
|
|
|
|
|
} else {
|
|
|
|
|
info := strings.Split(string(out), " ")
|
|
|
|
|
info := strings.Split(strings.TrimSpace(string(out)), "-")
|
|
|
|
|
if len(info) == 1 {
|
|
|
|
|
versionString = fmt.Sprintf(
|
|
|
|
|
"**VERSION > **Current running version: __%s.0__ (Internal ID: unknown)",
|
|
|
|
|
info[0],
|
|
|
|
|
)
|
|
|
|
|
} else {
|
|
|
|
|
versionString = fmt.Sprintf(
|
|
|
|
|
"**VERSION > **Current running version: __%s.%s__ (Internal ID: %s)",
|
|
|
|
|
info[0], info[1], info[2],
|
|
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
s.ChannelMessageSend(m.ChannelID, versionString)
|
|
|
|
|
return nil
|
|
|
|
|
}
|
|
|
|
|