more work on message parsing

This commit is contained in:
Cynthia Foxwell 2023-07-09 14:00:49 -06:00
parent 6b5857d382
commit 2ba9b1405f
8 changed files with 226 additions and 41 deletions

11
commands/clear.go Normal file
View file

@ -0,0 +1,11 @@
package commands
import (
"fmt"
"github.com/bwmarrin/discordgo"
)
func ClearCommand(session *discordgo.Session) {
fmt.Print("\n\r\033[H\033[2J")
}

View file

@ -21,6 +21,11 @@ func Setup() {
Run: HelpCommand,
Description: "command help",
}
commandMap["c"] = Command{
Run: ClearCommand,
Description: "clear",
}
}
func GetCommand(key string) (Command, bool) {

View file

@ -3,6 +3,7 @@ package commands
import (
"fmt"
"strings"
"unicode/utf8"
"github.com/Cynosphere/comcord/lib"
"github.com/Cynosphere/comcord/state"
@ -20,7 +21,7 @@ func SendMode(session *discordgo.Session) {
state.SetInPrompt(true)
length := len(session.State.User.Username) + 2
length := utf8.RuneCountInString(session.State.User.Username) + 2
curLength := state.GetNameLength()
prompt := fmt.Sprintf("[%s]%s", session.State.User.Username, strings.Repeat(" ", (curLength - length) + 1))