Added hints to wordmash.
This commit is contained in:
parent
db0ce247ca
commit
3fe4cb4292
|
@ -129,6 +129,25 @@ function define(word, context) {
|
|||
context.sendMessage(`No definition available for **${word}**, @${context.user.username}`, context.room.id);
|
||||
}
|
||||
|
||||
function hint(context) {
|
||||
if (!mash) {
|
||||
context.sendMessage(`There is no mash going on right now, @${context.user.username}. Start one with ${config.prefix}mash {length}`, context.room.id);
|
||||
return;
|
||||
}
|
||||
|
||||
if (mash.anagram.length <= 3) {
|
||||
context.sendMessage(`The mash **${mash.anagram}** is too short for a hint, @${context.user.username}.`, context.room.id);
|
||||
return;
|
||||
}
|
||||
|
||||
if (mash.anagram.length === 4) {
|
||||
context.sendMessage(`Hints for **${mash.anagram}**, @${context.user.username}: ${mash.answers.map((answer) => `**${answer.word.slice(0, 1)} ${'_ '.repeat(answer.word.length - 1).trim()}**`).join(', ')}`, context.room.id);
|
||||
return;
|
||||
}
|
||||
|
||||
context.sendMessage(`Hints for **${mash.anagram}**, @${context.user.username}: ${mash.answers.map((answer) => `**${answer.word.slice(0, 1)} ${'_ '.repeat(answer.word.length - 2)}${answer.word.slice(-1)}**`).join(', ')}`, context.room.id);
|
||||
}
|
||||
|
||||
function onCommand(args, context) {
|
||||
const word = args[0];
|
||||
const length = Number(word);
|
||||
|
@ -143,6 +162,11 @@ function onCommand(args, context) {
|
|||
return;
|
||||
}
|
||||
|
||||
if (['hint'].includes(context.subcommand)) {
|
||||
hint(context);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!Number.isNaN(length)) {
|
||||
start(length, context);
|
||||
return;
|
||||
|
|
Loading…
Reference in New Issue