~kris/9p

disco

05c7953a3bb9c5b2a21cfc8f3cf24f54224b7644 — Sean Hinchee 9 years ago 11d5e94
Cleaning up v1.0
4 files changed, 30 insertions(+), 8 deletions(-)

M README.md
M main.go
M menu.go
M mkfile
M README.md => README.md +4 -0
@@ 32,3 32,7 @@ Commands available in chat:
| :c      | Change listening Channel inside Guild |
| :m [n]      | Display last [n] messages: ex. `:m 2` displays last two messages |
| :p      | Pulls up the private channel menu |

## Notes

If you can connect to a channel and see messages, but yours aren't sending, check to make sure your e-mail address is verified.

M main.go => main.go +4 -3
@@ 38,7 38,7 @@ func main() {
	GetConfig()
	CheckState()
	Clear()
	Msg(HeaderMsg, "disco ­ version: %s\n\n", Version)
	Msg(HeaderMsg, "disco version: %s\n\n", Version)

	//NewSession
	Session = DiscordState.NewSession(Config.Username, Config.Password) //Please don't abuse


@@ 75,9 75,10 @@ func main() {
		line = ParseForCommands(line)

		line = ParseForMentions(line)

		
		if line != "" {
			State.Session.DiscordGo.ChannelMessageSend(State.Channel.ID, line)
			/*_ ,err :=*/ State.Session.DiscordGo.ChannelMessageSend(State.Channel.ID, line)
			//fmt.Print("Error: ", err, "\n")
		}
	}


M menu.go => menu.go +11 -5
@@ 4,6 4,8 @@ import (
	"fmt"
	"log"
	"strconv"
	"bufio"
	"os"
)

//SelectPrivateMenu is a menu item that changes to a private channel


@@ 217,7 219,7 @@ Start:
	Msg(InfoMsg, "Extra Options:\n")
	Msg(TextMsg, "[n] Join New Server\n")
	Msg(TextMsg, "[d] Leave Server\n")
	Msg(TextMsg, "[o] Join Official discord-cli Server\n")
	Msg(TextMsg, "[o] Join Official 9fans Server\n")
	Msg(TextMsg, "[b] Go Back\n")

	var response string


@@ 237,7 239,11 @@ Start:
			goto New
		}
		Msg(TextMsg, "Join %s ? [y/n]:\n", Invite.Guild.Name)
		fmt.Scanf("%s\n", &response)
		reader := bufio.NewReader(os.Stdin)
		response, _ := reader.ReadString('\n')
		response = response[:len(response)-1]
		
		//fmt.Scanf("%s\n", &response)
		if response == "y" {
			Session.DiscordGo.InviteAccept(Invite.Code)
			err := Session.Update()


@@ 248,12 254,12 @@ Start:
			goto Start
		}
	case "o":
		_, err := Session.DiscordGo.InviteAccept("0pXWCo5RQbVuFHDM")
		_, err := Session.DiscordGo.InviteAccept("https://discord.gg/6daut5T")
		if err != nil {
			Msg(ErrorMsg, "Joining Official discord-cli Server failed\n")
			Msg(ErrorMsg, "Joining Official 9fans Server failed\n")
			goto Start
		}
		Msg(InfoMsg, "Joined Official discord-cli Server!\n")
		Msg(InfoMsg, "Joined Official 9fans Server!\n")
	case "d":
		LeaveServerMenu()
		goto Start

M mkfile => mkfile +11 -0
@@ 18,3 18,14 @@ crypto:
	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

rebuild: 
	go install bitbucket.org/henesy/disco
	mk install

bins: 
	arch=(amd64 386 arm)
	for(a in $arch){
		GOARCH=$a go build
		cp disco bin/^$a^/
	}