use tag info in version
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
6f22f580dd
commit
2eff2a3559
3
Makefile
3
Makefile
@ -2,12 +2,13 @@ GOFILES=$(wildcard *.go)
|
||||
PROG=simpbot
|
||||
#set variables
|
||||
GIT_COMMIT := $(shell git rev-list -1 HEAD)
|
||||
GIT_TAG := $(shell git describe --tags | cut -d- -f1)
|
||||
ifeq ($(PREFIX),) # PREFIX is environment variable, but if it is not set, then set default value
|
||||
PREFIX := /usr/local
|
||||
endif
|
||||
|
||||
$(PROG): $(GOFILES)
|
||||
go build -ldflags "-X main.GitCommit=$(GIT_COMMIT)"
|
||||
go build -ldflags "-X main.GitCommit=$(GIT_COMMIT) -X main.GitTag=$(GIT_TAG)"
|
||||
|
||||
clean:
|
||||
rm -f simpbot
|
||||
|
9
main.go
9
main.go
@ -22,6 +22,7 @@ var Password string
|
||||
var DimensionServer string
|
||||
var HomeserverDomain string
|
||||
var GitCommit string
|
||||
var GitTag string
|
||||
var Statefile string
|
||||
var CurrStreamCnt int
|
||||
var MostStreamCnt int
|
||||
@ -100,11 +101,15 @@ func main() {
|
||||
vlist = append(vlist, fmt.Sprintf("%v Total:%v", vt.Name, vt.TotalStreams))
|
||||
t = t + vt.TotalStreams
|
||||
}
|
||||
statmsg = fmt.Sprintf("Current Stats Since %v:\n%v\nTotal Streams: %v\nMost Concurrent: %v/%v\n", StartTime, strings.Join(vlist, "\n"), t, MostStreamCnt, len(vtubers))
|
||||
statmsg = fmt.Sprintf("Current Stats Since %v:\n%v\n\nTotal Streams: %v\nMost Concurrent: %v/%v\n", StartTime, strings.Join(vlist, "\n"), t, MostStreamCnt, len(vtubers))
|
||||
client.SendText(evt.RoomID, statmsg)
|
||||
case "version":
|
||||
// print version
|
||||
client.SendText(evt.RoomID, "SimpBot version "+GitCommit)
|
||||
if GitTag != "" {
|
||||
client.SendText(evt.RoomID, "SimpBot version "+GitTag)
|
||||
} else {
|
||||
client.SendText(evt.RoomID, "SimpBot version "+GitCommit)
|
||||
}
|
||||
case "reload":
|
||||
//reload config
|
||||
client.SendText(evt.RoomID, "Reloading config")
|
||||
|
Loading…
Reference in New Issue
Block a user