diff options
Diffstat (limited to 'internal/game/cmd_say.go')
| -rw-r--r-- | internal/game/cmd_say.go | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/internal/game/cmd_say.go b/internal/game/cmd_say.go index 3d619a0..f21ed88 100644 --- a/internal/game/cmd_say.go +++ b/internal/game/cmd_say.go @@ -2,10 +2,24 @@ package game import ( "fmt" + "strings" "thehouseoficarus/internal/net" ) +func (g *Game) executeSay(sess *net.Session, args []string, rawInput string) { + if len(args) == 0 { + sess.WriteLine("Say what?") + } else { + msgStart := strings.Index(strings.ToLower(rawInput), "say ") + 4 + if msgStart >= 4 && msgStart < len(rawInput) { + g.doSay(sess, rawInput[msgStart:]) + } else { + g.doSay(sess, strings.Join(args, " ")) + } + } +} + func (g *Game) doSay(sess *net.Session, msg string) { p := sess.Player roomID := p.RoomID |
