Updated SChat color styling. Censoring answers in Mash hints. Restored Letters board.

This commit is contained in:
ThePendulum 2022-10-23 02:46:41 +02:00
parent 5c1d622862
commit be2e3c8a00
6 changed files with 26 additions and 2191333 deletions

1
.gitignore vendored
View File

@ -2,3 +2,4 @@ node_modules/
config/*
!config/default.js
points*.json
assets/mash-words.json

View File

@ -24,13 +24,16 @@ module.exports = {
channels: ['GamesNight'],
games: ['mash', 'trivia', 'letters', 'duck', 'ping', 'say', 'kill', 'help'],
schatColors: {
red: 'var(--message-3)',
green: 'var(--message-23)',
yellow: 'var(--message-12)',
pink: 'var(--message-57)',
cyan: 'var(--message-31)',
grey: 'var(--shadow)',
// grey: 'var(--message-59)',
red: 'red',
orange: 'orange',
yellow: 'yellow',
green: 'green',
cyan: 'cyan',
blue: 'blue',
purple: 'purple',
magenta: 'magenta',
pink: 'pink',
grey: 'shadow',
},
trivia: {
mode: 'first', // first or timeout

2191321
mash-words.json

File diff suppressed because it is too large Load Diff

View File

@ -22,7 +22,7 @@ const games = new Map();
function getBoard(context) {
const game = games.get(context.room.id);
return `${style.grey('[')}${game.word.split('').concat(Array.from({ length: config.letters.length - game.word.length })).map((letter) => style.bold(letter?.toUpperCase()) || '').join(style.grey('|'))}${style.grey(']')}`; // eslint-disable-line no-irregular-whitespace
return `${style.grey('[')}${game.word.split('').concat(Array.from({ length: config.letters.length - game.word.length })).map((letter) => style.bold(letter?.toUpperCase()) || '').join(style.grey('|'))}${style.grey(']')}`; // eslint-disable-line no-irregular-whitespace
}
function countLetters(word) {

View File

@ -142,6 +142,16 @@ function define(word, context) {
context.sendMessage(`No definition available for ${style.bold(word)}, ${config.usernamePrefix}${context.user.username}`, context.room.id);
}
function sanitizeDefinition(definition, answers) {
return definition.replaceAll(/\w+/g, (word) => {
if (answers.some((answer) => answer.word.includes(word))) {
return '*'.repeat(word.length);
}
return word;
});
}
function hint(context) {
const mash = mashes.get(context.room.id);
@ -156,11 +166,11 @@ function hint(context) {
}
if (mash.anagram.length === 4) {
context.sendMessage(`Hints for ${style.bold(style.pink(mash.anagram))}, ${config.usernamePrefix}${context.user.username}: ${mash.answers.map((answer) => `${style.bold(`${answer.word.slice(0, 1)} ${'_ '.repeat(answer.word.length - 1).trim()}`)} (${answer.definitions[0]})`).join(', ')}`, context.room.id);
context.sendMessage(`Hints for ${style.bold(style.pink(mash.anagram))}, ${config.usernamePrefix}${context.user.username}: ${mash.answers.map((answer) => `${style.bold(`${answer.word.slice(0, 1)} ${'_ '.repeat(answer.word.length - 1).trim()}`)} (${sanitizeDefinition(answer.definitions[0], mash.answers)})`).join(', ')}`, context.room.id);
return;
}
context.sendMessage(`Hints for ${style.bold(mash.anagram)}, ${config.usernamePrefix}${context.user.username}: ${mash.answers.map((answer) => `${style.bold(`${answer.word.slice(0, 1)} ${'_ '.repeat(answer.word.length - 2)}${answer.word.slice(-1)}`)} (${answer.definitions[0]})`).join(', ')}`, context.room.id);
context.sendMessage(`Hints for ${style.bold(mash.anagram)}, ${config.usernamePrefix}${context.user.username}: ${mash.answers.map((answer) => `${style.bold(`${answer.word.slice(0, 1)} ${'_ '.repeat(answer.word.length - 2)}${answer.word.slice(-1)}`)} (${sanitizeDefinition(answer.definitions[0], mash.answers)})`).join(', ')}`, context.room.id);
}
function onCommand(args, context) {
@ -194,7 +204,7 @@ function onCommand(args, context) {
}
if (!word || !mash) {
context.sendMessage(`Start a mash with ${config.prefix}mash [length]`, context.room.id);
context.sendMessage(`Start a mash with ${config.prefix}mash [length]`, context.room.id, { styleCommands: true });
return;
}

View File

@ -12,7 +12,7 @@ function schatItalic(text) {
}
function schatColor(text, color) {
return `<span style="color: ${color}">${text}</span>`;
return `{${color}}(${text})`;
}
function curate(fn) {