~ecs/irchess

f94edde5a0f85ea9be1cfe543a53a80081c03de7 — Ember Sawady 4 years ago 6cd37ac
Allow bare moves

`e4` instead of `!chess move e4`
1 files changed, 7 insertions(+), 0 deletions(-)

M main.go
M main.go => main.go +7 -0
@@ 38,6 38,13 @@ func paste() (string, error) {

func onmsg(c *girc.Client, e girc.Event) {
	cmd := strings.Split(e.Last(), " ")
	if len(cmd) == 1 && game != nil {
		_, err := chess.AlgebraicNotation{}.Decode(game.Position(), cmd[0])
		if err != nil {
			return
		}
		cmd = []string{"!chess", "move", cmd[0]}
	}
	if len(cmd) < 2 || cmd[0] != "!chess" {
		return
	}