diff --git a/README.md b/README.md index 0315ce4..07d8591 100644 --- a/README.md +++ b/README.md @@ -12,9 +12,9 @@ TODO Go is more portable than Node.js ## TODO -- [ ] Send mode +- [x] Send mode - [ ] Commands - - [ ] Quit (q) + - [x] Quit (q) - [ ] Switch guilds (G) - [ ] Switch channels (g) - [ ] List online users in guild (w) @@ -25,6 +25,8 @@ Go is more portable than Node.js - Creation date, join date, ID, etc - [ ] Room history (r) - [ ] Extended room history (R) + - [ ] Peek (p) + - [ ] Cross-guild peek (P) - [ ] List channels (l) - [ ] List guilds (L) - [ ] Clear (c) @@ -33,20 +35,20 @@ Go is more portable than Node.js - [ ] AFK toggle (A) - [ ] Send DM (s) - [ ] Answer DM (a) -- [ ] Message Receiving +- [x] Message Receiving - Markdown styling - - [ ] Emotes + - [x] Emotes - [ ] Timestamp parsing - - [ ] Mentions parsing + - [x] Mentions parsing - [ ] Embeds in the style of commode's posted links - - [ ] Messages wrapped in `*`'s or `_`'s parsed as emotes - - [ ] Inline DMs to replicate commode's private messages - - [ ] Replies + - [x] Messages wrapped in `*`'s or `_`'s parsed as emotes + - [x] Inline DMs to replicate commode's private messages + - [x] Replies - [ ] Group DMs -- [ ] Message sending - - [ ] Puts incoming messages into queue whilst in send mode -- [ ] Configuration - - [ ] Write token from argv into rc file if rc file doesn't exist - - [ ] Default guild/channel +- [x] Message sending + - [x] Puts incoming messages into queue whilst in send mode +- [x] Configuration + - [x] Write token from argv into rc file if rc file doesn't exist + - [x] Default guild/channel - [ ] Threads - [ ] External rich presence when using bot accounts diff --git a/commands/quit.go b/commands/quit.go index eea1472..8c81036 100644 --- a/commands/quit.go +++ b/commands/quit.go @@ -1,12 +1,14 @@ package commands import ( + "fmt" "os" "github.com/bwmarrin/discordgo" ) func QuitCommand(session *discordgo.Session) { + fmt.Print("Unlinking TTY...\n\r") session.Close() os.Exit(0) } diff --git a/main.go b/main.go index 75b4082..0b8bdde 100644 --- a/main.go +++ b/main.go @@ -66,7 +66,8 @@ func main() { // TODO: user account support client, err := discordgo.New("Bot " + token) if err != nil { - fmt.Println("\r% Failed to create client:", err) + fmt.Println("% Failed to create client:", err) + fmt.Print("\r") os.Exit(1) return } @@ -93,7 +94,8 @@ func main() { err = client.Open() if err != nil { - fmt.Println("\r% Failed to connect to Discord:", err) + fmt.Println("% Failed to connect to Discord:", err) + fmt.Print("\r") os.Exit(1) return } @@ -101,8 +103,7 @@ func main() { keyboard.Listen(func(key keys.Key) (stop bool, err error) { if !state.IsInPrompt() { if key.Code == keys.CtrlC { - client.Close() - os.Exit(0) + commands.QuitCommand(client) return true, nil } else { command, has := commands.GetCommand(key.String())