~kris/9p

disco

57402ac47735ba291bbec96ca1a8a5f3e065da92 — Sean Hinchee 7 years ago 941ae49
change :u to :n ;; misc cleanups ;; improve readme with accurate information
2 files changed, 15 insertions(+), 13 deletions(-)

M README.md
M commands.go
M README.md => README.md +3 -2
@@ 27,11 27,12 @@ Commands available in chat:
| Command       | Function    |
| ------------- |-------------|
| :q        | Quits disco |
| :g        | Change listening Guild|
| :c [n|?]  | Change listening Channel inside Guild, or list channels |
| :g        | Change listening Guild |
| :c [n ?]  | Change listening Channel inside Guild, or list channels |
| :m [n]    | Display last [n] messages: ex. `:m 2` displays last two messages |
| :p        | Pulls up the private channel menu |
| :n name   | Change nickname to `name` |
| :?        | List the available commands |

You can regex the last message sent using a format such as:


M commands.go => commands.go +12 -11
@@ 50,14 50,15 @@ func ParseForCommands(line string) string {
		return line
	case ":?":
		// Show help menu
		Msg(TextMsg, "Commands: ")
		Msg(TextMsg, "[:g] - Select guild")
		Msg(TextMsg, "[:p] - Select private message")
		Msg(TextMsg, "[:c] - Select guild channel")
		Msg(TextMsg, "[:c ?] - List guild channels")
		Msg(TextMsg, "[:c <num>] - Go directly to channel")
		Msg(TextMsg, "[:m <num>] - Display last <num> messages")
		Msg(TextMsg, "[:u <name>] - Change username")
		Msg(TextMsg, "Commands: \n")
		Msg(TextMsg, "[:g] - Open guild menu\n")
		Msg(TextMsg, "[:p] - Open private message menu\n")
		Msg(TextMsg, "[:c] - Open guild channel menu\n")
		Msg(TextMsg, "[:c ?] - List guild channels\n")
		Msg(TextMsg, "[:c <num>] - Go directly to channel <num>\n")
		Msg(TextMsg, "[:m <num>] - Display last <num> messages\n")
		Msg(TextMsg, "[:n <name>] - Change username to <name>\n")
		return ""
	case ":g":
		SelectGuild()
		return ""


@@ 117,13 118,13 @@ func ParseForCommands(line string) string {
		State.RetrieveMessages(Amount)
		PrintMessages(Amount)
		return ""
	case ":u":
	case ":n":
		session := State.Session
		user := session.User
		newName := strings.TrimPrefix(line, ":u ")
		newName := strings.TrimPrefix(line, ":n ")
		_, err := State.Session.DiscordGo.UserUpdate(user.Email, session.Password, newName, user.Avatar, "")
		if err != nil {
			Msg(ErrorMsg, "[:u] Argument Error: %s\n", err)
			Msg(ErrorMsg, "[:n] Argument Error: %s\n", err)
			return ""
		}
		Msg(TextMsg, "name -> %s\n", newName)