From dbdd3258b25e473bd46058b72b88aa809aadd63f Mon Sep 17 00:00:00 2001 From: Tulir Asokan Date: Thu, 29 Apr 2021 14:00:26 +0300 Subject: [PATCH] Fix version command output --- commands.go | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/commands.go b/commands.go index 4a129f7..b9ec589 100644 --- a/commands.go +++ b/commands.go @@ -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,