From 4d4441c5d63e42226d6f690b75f35dcbebb6c8fd Mon Sep 17 00:00:00 2001 From: pyed Date: Mon, 27 Jun 2016 20:23:26 +0300 Subject: [PATCH] impl: version --- transmission-telegram.go | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/transmission-telegram.go b/transmission-telegram.go index 0945534..3909cce 100644 --- a/transmission-telegram.go +++ b/transmission-telegram.go @@ -200,6 +200,8 @@ func main() { // prints a help message case "version", "/version": // print transmission and transmission-telegram versions + go version(&update) + case "": // might be a file received go receiveTorrent(&update) @@ -481,7 +483,7 @@ func info(ud *tgbotapi.Update, tokens []string) { } // format the info - info := fmt.Sprintf("<%d> %s\n%s\t%s of %s (%.2f%%)\t⬇ %s ⬆ %s R:%.3f\nUP: %s DL: %s Added: %s ETA: %d\nTracker: %s", + info := fmt.Sprintf("<%d> %s\n%s\t%s of %s (%.2f%%)\t↓ %s ↑ %s R:%.3f\nUP: %s DL: %s Added: %s ETA: %d\nTracker: %s", torrent.ID, torrent.Name, torrent.TorrentStatus(), humanize.Bytes(torrent.DownloadedEver), humanize.Bytes(torrent.SizeWhenDone), torrent.PercentDone*100, humanize.Bytes(torrent.RateDownload), humanize.Bytes(torrent.RateUpload), torrent.UploadRatio, humanize.Bytes(torrent.UploadedEver), humanize.Bytes(torrent.DownloadedEver), time.Unix(torrent.AddedDate, 0).Format(time.Stamp), @@ -716,6 +718,13 @@ func deldata(ud *tgbotapi.Update, tokens []string) { } } +// help + +// version sends transmission version + transmission-telegram version +func version(ud *tgbotapi.Update) { + send(fmt.Sprintf("Transmission %s\nTransmission-telegram %s", Client.Version(), VERSION), ud.Message.Chat.ID) +} + // send takes a chat id and a message to send. func send(text string, chatID int64) { // set typing action