autofish's colorable output for windows
and non color output for daze
This commit is contained in:
@ -3,6 +3,7 @@ package main
|
||||
import (
|
||||
"github.com/Tnze/go-mc/bot"
|
||||
"github.com/Tnze/go-mc/chat"
|
||||
"github.com/mattn/go-colorable"
|
||||
"log"
|
||||
"time"
|
||||
)
|
||||
@ -15,6 +16,7 @@ var (
|
||||
)
|
||||
|
||||
func main() {
|
||||
log.SetOutput(colorable.NewColorableStdout())
|
||||
c = bot.NewClient()
|
||||
|
||||
//Login
|
||||
|
@ -47,7 +47,7 @@ func onGameStart() error {
|
||||
}
|
||||
|
||||
func onChatMsg(c chat.Message, pos byte) error {
|
||||
log.Println("Chat:", c)
|
||||
log.Println("Chat:", c.ClearString()) // output chat message without any format code (like color or bold)
|
||||
return nil
|
||||
}
|
||||
|
||||
|
5
go.mod
5
go.mod
@ -2,4 +2,7 @@ module github.com/Tnze/go-mc
|
||||
|
||||
go 1.12
|
||||
|
||||
require github.com/google/uuid v1.1.1
|
||||
require (
|
||||
github.com/google/uuid v1.1.1
|
||||
github.com/mattn/go-colorable v0.1.2 // indirect
|
||||
)
|
||||
|
5
go.sum
5
go.sum
@ -1,2 +1,7 @@
|
||||
github.com/google/uuid v1.1.1 h1:Gkbcsh/GbpXz7lPftLA3P6TYMwjCLYm83jiFQZF/3gY=
|
||||
github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
|
||||
github.com/mattn/go-colorable v0.1.2 h1:/bC9yWikZXAL9uJdulbSfyVNIR3n3trXl+v8+1sx8mU=
|
||||
github.com/mattn/go-colorable v0.1.2/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE=
|
||||
github.com/mattn/go-isatty v0.0.8 h1:HLtExJ+uU2HOZ+wI0Tt5DtUDrx8yhUqDcp7fYERX4CE=
|
||||
github.com/mattn/go-isatty v0.0.8/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s=
|
||||
golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
|
Reference in New Issue
Block a user