~ecs/irchess

2df77155895e9aab99ad4762e808ae42f77364c0 — Ember Sawady 3 years ago 6766332
Minor updates
1 files changed, 3 insertions(+), 6 deletions(-)

M main.go
M main.go => main.go +3 -6
@@ 23,14 23,12 @@ const server = "d2evs.net"
const port = 6696
const name = "quaternia"
const path = "/var/www/p.d2evs.net/"
const urlpfx = "https://p.d2evs.net/"
const urlpfx = "gemini://p.d2evs.net/"

func paste() (string, error) {
	state := game.Position().Board().Draw() + "\n\n# PGN\n\n" + game.String() +
		"\n\n# FEN\n\n" + game.FEN()
	name := strconv.Itoa(int(crc32.ChecksumIEEE([]byte(state)))) + ".txt"
	// XXX: Consider supporting user-specified paste commands (upload text
	// goes into stdin, paste URL comes out of stdout)
	f, err := os.Create(path + name)
	if err != nil {
		return "", err


@@ 47,9 45,9 @@ func onmsg(c *girc.Client, e girc.Event) {
		if err != nil {
			return
		}
		cmd = []string{"!chess", "move", cmd[0]}
		cmd = []string{".chess", "move", cmd[0]}
	}
	if len(cmd) < 2 || cmd[0] != "!chess" {
	if len(cmd) < 2 || cmd[0] != ".chess" {
		return
	}



@@ 177,7 175,6 @@ func main() {
		SASL:   sasl,
	})
	client.Handlers.Add(girc.CONNECTED, func(c *girc.Client, e girc.Event) {
		// TODO: join user-specified channels
		fmt.Println("connected")
		c.Handlers.Add(girc.PRIVMSG, onmsg)
	})