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/*
!config/default.js !config/default.js
points*.json points*.json
assets/mash-words.json

View File

@ -24,13 +24,16 @@ module.exports = {
channels: ['GamesNight'], channels: ['GamesNight'],
games: ['mash', 'trivia', 'letters', 'duck', 'ping', 'say', 'kill', 'help'], games: ['mash', 'trivia', 'letters', 'duck', 'ping', 'say', 'kill', 'help'],
schatColors: { schatColors: {
red: 'var(--message-3)', red: 'red',
green: 'var(--message-23)', orange: 'orange',
yellow: 'var(--message-12)', yellow: 'yellow',
pink: 'var(--message-57)', green: 'green',
cyan: 'var(--message-31)', cyan: 'cyan',
grey: 'var(--shadow)', blue: 'blue',
// grey: 'var(--message-59)', purple: 'purple',
magenta: 'magenta',
pink: 'pink',
grey: 'shadow',
}, },
trivia: { trivia: {
mode: 'first', // first or timeout 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) { function getBoard(context) {
const game = games.get(context.room.id); 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) { 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); 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) { function hint(context) {
const mash = mashes.get(context.room.id); const mash = mashes.get(context.room.id);
@ -156,11 +166,11 @@ function hint(context) {
} }
if (mash.anagram.length === 4) { 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; 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) { function onCommand(args, context) {
@ -194,7 +204,7 @@ function onCommand(args, context) {
} }
if (!word || !mash) { 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; return;
} }

View File

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