MCPcopy Create free account
hub / github.com/GoMudEngine/GoMud / parseLookTarget

Function parseLookTarget

modules/gambling/gambling.go:75–91  ·  view source on GitHub ↗

parseLookTarget extracts the target string from a look command input, stripping the leading "at " and "the " prefixes that the core look command also strips. Returns an empty string if the input is not a look command or has no target.

(inputText string)

Source from the content-addressed store, hash-verified

73// the leading "at " and "the " prefixes that the core look command also strips.
74// Returns an empty string if the input is not a look command or has no target.
75func parseLookTarget(inputText string) string {
76 lower := strings.ToLower(strings.TrimSpace(inputText))
77
78 cmd, rest, _ := strings.Cut(lower, " ")
79 if cmd != `look` && cmd != `l` {
80 return ""
81 }
82
83 rest = strings.TrimSpace(rest)
84 if strings.HasPrefix(rest, `at `) {
85 rest = rest[3:]
86 }
87 if strings.HasPrefix(rest, `the `) {
88 rest = rest[4:]
89 }
90 return strings.TrimSpace(rest)
91}
92
93// onLookInput intercepts look commands directed at gambling fixtures before the
94// engine's look handler runs. If the target matches a fixture present in the

Callers 1

onLookInputMethod · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected