From 9dc2df518e2cdf563f879c2b7f95064303d0bb57 Mon Sep 17 00:00:00 2001 From: Sean Hinchee Date: Mon, 24 Jul 2017 21:10:24 -0500 Subject: [PATCH] patching out color --- DiscordGo/structs.go | 2 +- DiscordGo/voice.go | 2 +- DiscordGo/wsapi.go | 2 +- helper.go | 23 +++++++++++++++-------- mkfile | 14 ++++++++++++++ 5 files changed, 32 insertions(+), 11 deletions(-) create mode 100644 mkfile diff --git a/DiscordGo/structs.go b/DiscordGo/structs.go index a765efee3e0615151aa502c21e4621a182b04e67..14883a9ba0c64ca7a9ef350c6b73907b9df97ad2 100644 --- a/DiscordGo/structs.go +++ b/DiscordGo/structs.go @@ -17,7 +17,7 @@ import ( "sync" "time" - "github.com/gorilla/websocket" + "bitbucket.org/henesy/disco/websocket" ) // A Session represents a connection to the Discord API. diff --git a/DiscordGo/voice.go b/DiscordGo/voice.go index dcd0c94b9d12e368b2f2ac911049ad9ce3e19d93..507e4f49a02ee85c549f935f35e37a2ac5d594f7 100644 --- a/DiscordGo/voice.go +++ b/DiscordGo/voice.go @@ -19,7 +19,7 @@ import ( "sync" "time" - "github.com/gorilla/websocket" + "bitbucket.org/henesy/disco/websocket" ) // ------------------------------------------------------------------------------------------------ diff --git a/DiscordGo/wsapi.go b/DiscordGo/wsapi.go index a00658f2ae3931d23bcc65393b5265ce35713a6e..0963e8eea721f8b4c7227b0a99b9da2252403242 100644 --- a/DiscordGo/wsapi.go +++ b/DiscordGo/wsapi.go @@ -22,7 +22,7 @@ import ( "runtime" "time" - "github.com/gorilla/websocket" + "bitbucket.org/henesy/disco/websocket" ) type handshakeProperties struct { diff --git a/helper.go b/helper.go index ee7af89d93e545cceb817fc8ee8728f65d7a5570..99b59110a1f5cdd1f3a3e9b27bdeb97549bb99be 100644 --- a/helper.go +++ b/helper.go @@ -1,21 +1,22 @@ package main import ( - "encoding/binary" +// "encoding/binary" "log" - "math" +// "math" "os" "os/exec" "strings" "time" + "fmt" - "bitbucket.org/henesy/disco/color" +// "bitbucket.org/henesy/disco/color" "bitbucket.org/henesy/disco/DiscordGo" ) //HexColor is a struct gives RGB values type HexColor struct { - Color color.Attribute +// Color color.Attribute R int G int B int @@ -26,12 +27,13 @@ func Msg(MsgType, format string, a ...interface{}) { // TODO: Add support for changing color by configuration - Error := color.New(color.FgRed, color.Bold) +/* Error := color.New(color.FgRed, color.Bold) Info := color.New(color.FgYellow, color.Bold) Head := color.New(color.FgCyan, color.Bold) Text := color.New(color.FgWhite) switch MsgType { + case "Error": Error.Printf(format, a...) case "Info": @@ -42,7 +44,8 @@ func Msg(MsgType, format string, a ...interface{}) { Text.Printf(format, a...) default: Text.Printf(format, a...) - } + }*/ + fmt.Print(a...) } //Clear clears the terminal => This barely works, please fix @@ -116,19 +119,22 @@ func Notify(m *discordgo.Message) { //MessagePrint prints one correctly formatted Message to stdout func MessagePrint(Time, Username, Content string) { - var Color color.Attribute + //var Color color.Attribute TimeStamp, _ := time.Parse(time.RFC3339, Time) LocalTime := TimeStamp.Local().Format("2006/01/02 15:04:05") + /* if val, ok := State.MemberRole[Username]; ok { Color = ColorMatch(val.Color) } UserName := color.New(Color).SprintFunc() + */ log.SetFlags(0) - log.Printf("%s > %s > %s\n", LocalTime, UserName(Username), Content) + log.Printf("%s > %s > %s\n", LocalTime, Username, Content) log.SetFlags(log.LstdFlags) } +/* //ColorMatch compares HEX->DEC colorcoding and returns the closest ANSI color func ColorMatch(colorinput int) color.Attribute { var Result float64 @@ -160,6 +166,7 @@ func ColorMatch(colorinput int) color.Attribute { return ColorResult } +*/ func dis(a, b int) float64 { return float64((a - b) * (a - b)) diff --git a/mkfile b/mkfile new file mode 100644 index 0000000000000000000000000000000000000000..6649c306b34fb7f7cde8a8800c7c504688d8739d --- /dev/null +++ b/mkfile @@ -0,0 +1,14 @@ +all: + go build + +deps: + mkdir -p $GOPATH/src/bitbucket.org/henesy/disco + dircp ./ $GOPATH/src/bitbucket.org/henesy/disco + +crypto: + orig=`{pwd} + mkdir -p $GOPATH/src/golang.org/x/crypto + cd $GOPATH/src/golang.org/x + hget https://github.com/golang/crypto/archive/master.zip > crypto.zip; unzip -f crypto.zip + dircp crypto-master crypto; rm -r crypto-master + cd $orig