Fix version command output

This commit is contained in:
Tulir Asokan 2021-04-29 14:00:26 +03:00
parent 2742d90299
commit dbdd3258b2

View file

@ -206,13 +206,13 @@ func (handler *CommandHandler) CommandDevTest(_ *CommandEvent) {
const cmdVersionHelp = `version - View the bridge version`
func (handler *CommandHandler) CommandVersion(ce *CommandEvent) {
version := fmt.Sprintf("v%s.unknown", Version)
linkifiedVersion := fmt.Sprintf("v%s", Version)
if Tag == Version {
version = fmt.Sprintf("[v%s](%s/releases/v%s) (%s)", Version, URL, Tag, BuildTime)
linkifiedVersion = fmt.Sprintf("[v%s](%s/releases/v%s)", Version, URL, Tag)
} else if len(Commit) > 8 {
version = fmt.Sprintf("v%s.[%s](%s/commit/%s) (%s)", Version, Commit[:8], URL, Commit, BuildTime)
linkifiedVersion = strings.Replace(linkifiedVersion, Commit[:8], fmt.Sprintf("[%s](%s/commit/%s)", Commit[:8], URL, Commit), 1)
}
ce.Reply(fmt.Sprintf("[%s](%s) %s", Name, URL, version))
ce.Reply(fmt.Sprintf("[%s](%s) %s (%s)", Name, URL, linkifiedVersion, BuildTime))
}
const cmdInviteLinkHelp = `invite-link - Get an invite link to the current group chat.`
@ -606,6 +606,7 @@ func (handler *CommandHandler) CommandHelp(ce *CommandEvent) {
ce.Reply("* " + strings.Join([]string{
cmdPrefix + cmdHelpHelp,
cmdPrefix + cmdVersionHelp,
cmdPrefix + cmdLoginHelp,
cmdPrefix + cmdLogoutHelp,
cmdPrefix + cmdDeleteSessionHelp,