0
0
Fork 0

Add solve subcommand

This commit is contained in:
Oliver-Akins 2023-02-20 19:58:09 -07:00
parent ca92d9131a
commit bde3f00ee4

View file

@ -51,11 +51,30 @@ const subcommands: {[index: string]: subcommand} = {
method: `POST`,
url: `/${meta.channel}/guess`,
payload: {
type: `letter`,
guess: meta.args[1]
}
})).payload;
},
},
"solve": {
modOnly: false,
async handler(meta, req) {
if (meta.args.length < 2) {
return `You need to provide a solution if you want to solve!`;
};
return (await req.server.inject({
method: `POST`,
url: `/${meta.channel}/guess`,
payload: {
type: `solve`,
guess: meta.args.slice(1).join(` `)
}
})).payload;
},
},
};
const route: ServerRoute = {