|
|
|
@ -13,40 +13,54 @@ const alphabet = Array.from({ length: 26 }, (value, index) => String.fromCharCod
|
|
|
|
|
|
|
|
|
|
function getBoard(letters, showLetters, context) {
|
|
|
|
|
const wordle = wordles.get(context.room.id);
|
|
|
|
|
const prefix = style.grey(style.code('['));
|
|
|
|
|
const prefix = config.platform === 'irc' ? '' : style.grey(style.code('['));
|
|
|
|
|
|
|
|
|
|
const middle = letters.map((letter) => {
|
|
|
|
|
if (letter === null) {
|
|
|
|
|
return style.code(' '); // em space, U+2003, charcode 8195
|
|
|
|
|
return config.platform === 'irc'
|
|
|
|
|
? style.bgsilver(' ? ')
|
|
|
|
|
: style.code(' '); // em space, U+2003, charcode 8195
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (letter[1] === true) {
|
|
|
|
|
return style.green(style.bold(style.code(letter[0].toUpperCase())));
|
|
|
|
|
return config.platform === 'irc'
|
|
|
|
|
? style.bggreen(` ${letter[0].toUpperCase()}${style.green('*')}`)
|
|
|
|
|
: style.green(style.bold(style.code(letter[0].toUpperCase())));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (letter[1] === false) {
|
|
|
|
|
return style.orange(style.bold(style.code(letter[0].toUpperCase())));
|
|
|
|
|
return config.platform === 'irc'
|
|
|
|
|
? style.bgyellow(` ${letter[0].toUpperCase()}${style.yellow('?')}`)
|
|
|
|
|
: style.orange(style.bold(style.code(letter[0].toUpperCase())));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return style.grey(style.bold(style.code(letter[0].toUpperCase())));
|
|
|
|
|
}).join(style.grey(style.code('|')));
|
|
|
|
|
return config.platform === 'irc'
|
|
|
|
|
? style.bgsilver(` ${letter[0].toUpperCase()} `)
|
|
|
|
|
: style.grey(style.bold(style.code(letter[0].toUpperCase())));
|
|
|
|
|
}).join(config.platform === 'irc' ? '' : style.grey(style.code('|')));
|
|
|
|
|
|
|
|
|
|
const suffix = `${style.grey(style.code(']'))}`;
|
|
|
|
|
const suffix = config.platform === 'irc' ? '' : `${style.grey(style.code(']'))}`;
|
|
|
|
|
|
|
|
|
|
if (showLetters) {
|
|
|
|
|
const letterBoard = Array.from(wordle.letters).map(([letter, state]) => {
|
|
|
|
|
if (state === true) {
|
|
|
|
|
return style.green(style.bold(letter));
|
|
|
|
|
return config.platform === 'irc'
|
|
|
|
|
? style.bggreen(`${letter}${style.green('*')}`)
|
|
|
|
|
: style.green(style.bold(letter));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (state === false) {
|
|
|
|
|
return style.orange(style.bold(letter));
|
|
|
|
|
return config.platform === 'irc'
|
|
|
|
|
? style.bgyellow(`${letter}${style.yellow('?')}`)
|
|
|
|
|
: style.orange(style.bold(letter));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return style.grey(letter);
|
|
|
|
|
return config.platform === 'irc'
|
|
|
|
|
? letter
|
|
|
|
|
: style.grey(letter);
|
|
|
|
|
}).join(' ');
|
|
|
|
|
|
|
|
|
|
return `${prefix}${middle}${suffix} ${letterBoard}`; // eslint-disable-line no-irregular-whitespace
|
|
|
|
|
return `${prefix}${middle}${suffix} Letters: ${letterBoard}`; // eslint-disable-line no-irregular-whitespace
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return `${prefix}${middle}${suffix}`;
|
|
|
|
|