playCommand handles "play slots" / "play slot machine" / "play claw machine" / "play claw".
(rest string, user *users.UserRecord, room *rooms.Room, flags events.EventFlag)
| 174 | |
| 175 | // playCommand handles "play slots" / "play slot machine" / "play claw machine" / "play claw". |
| 176 | func (g *GamblingModule) playCommand(rest string, user *users.UserRecord, room *rooms.Room, flags events.EventFlag) (bool, error) { |
| 177 | |
| 178 | arg := strings.TrimSpace(rest) |
| 179 | |
| 180 | if m, c := util.FindMatchIn(arg, `slot machine`, `slots`, `slot`); m != `` || c != `` { |
| 181 | if !roomHasSlots(room) { |
| 182 | user.SendText(`There is no slot machine here.`) |
| 183 | return true, nil |
| 184 | } |
| 185 | g.playSlots(user, room) |
| 186 | return true, nil |
| 187 | } |
| 188 | |
| 189 | if m, c := util.FindMatchIn(arg, `claw machine`, `claw`); m != `` || c != `` { |
| 190 | if !roomHasClaw(room) { |
| 191 | user.SendText(`There is no claw machine here.`) |
| 192 | return true, nil |
| 193 | } |
| 194 | g.playClaw(user, room) |
| 195 | return true, nil |
| 196 | } |
| 197 | |
| 198 | user.SendText(`Play what? Try <ansi fg="command">play slots</ansi> or <ansi fg="command">play claw machine</ansi>.`) |
| 199 | return true, nil |
| 200 | } |
nothing calls this directly
no test coverage detected