<commit_before>package commands

import (
	"io/ioutil"
	"net/http"
	"net/url"
	"strings"
	"time"

	"github.com/hexbotio/hex/models"
)

func Version(message *models.Message, config models.Config) {
	response := "Version: Non Standard Build"
	if config.Version != "" {
		response = "Version: " + config.Version
	}
	var u url.URL
	u.Scheme = "https"
	u.Host = "hexbot.io"
	u.Path = "/downloads/latest"
	req, err := http.NewRequest("GET", u.String(), nil)
	if err != nil {
		config.Logger.Error("Version New Request - " + err.Error())
	} else {
		req.Header.Add("User-Agent", "HexBot")
		client := &http.Client{}
		client.Timeout = time.Duration(3) * time.Second
		resp, err := client.Do(req)
		if err != nil {
			config.Logger.Error("Version Response - " + err.Error())
		} else {
			if resp.StatusCode != 200 {
				config.Logger.Error("Version Response Error")
			} else {
				rawbody, err := ioutil.ReadAll(resp.Body)
				if err != nil {
					config.Logger.Error("Version Body Read - " + err.Error())
				}
				body := strings.TrimSpace(string(rawbody))
				response = response + " (latest is " + body + ")"
			}
		}
	}
	message.Outputs = append(message.Outputs, models.Output{
		Rule:     "version",
		Response: response,
	})
}<commit_msg>indicating current version if it matches latest<commit_after>package commands

import (
	"io/ioutil"
	"net/http"
	"net/url"
	"strings"
	"time"

	"github.com/hexbotio/hex/models"
)

func Version(message *models.Message, config models.Config) {
	response := "Version: Non Standard Build"
	if config.Version != "" {
		response = "Version: " + config.Version
	}
	var u url.URL
	u.Scheme = "https"
	u.Host = "hexbot.io"
	u.Path = "/downloads/latest"
	req, err := http.NewRequest("GET", u.String(), nil)
	if err != nil {
		config.Logger.Error("Version New Request - " + err.Error())
	} else {
		req.Header.Add("User-Agent", "HexBot")
		client := &http.Client{}
		client.Timeout = time.Duration(3) * time.Second
		resp, err := client.Do(req)
		if err != nil {
			config.Logger.Error("Version Response - " + err.Error())
		} else {
			if resp.StatusCode != 200 {
				config.Logger.Error("Version Response Error")
			} else {
				rawbody, err := ioutil.ReadAll(resp.Body)
				if err != nil {
					config.Logger.Error("Version Body Read - " + err.Error())
				}
				body := strings.TrimSpace(string(rawbody))
				if body != config.Version {
					response = response + " (latest is " + body + ")"
				} else {
					response = response + " (current)"
				}
			}
		}
	}
	message.Outputs = append(message.Outputs, models.Output{
		Rule:     "version",
		Response: response,
	})
}
{'fraction_non_alphanumeric': 0.16551459293394777, 'fraction_numerical': 0.0030721966205837174, 'mean_word_length': 3.208400646203554, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4696372', 'n_tokens_mistral': 1015, 'n_tokens_neox': 905, 'n_words': 201}