Compare commits

...

2 Commits

8 changed files with 29 additions and 2191336 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

4
package-lock.json generated
View File

@ -1,12 +1,12 @@
{
"name": "schat2-clive",
"version": "1.12.1",
"version": "1.12.2",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"name": "schat2-clive",
"version": "1.12.1",
"version": "1.12.2",
"license": "ISC",
"dependencies": {
"bhttp": "^1.2.8",

View File

@ -1,6 +1,6 @@
{
"name": "schat2-clive",
"version": "1.12.1",
"version": "1.12.2",
"description": "Game host for SChat 2-powered chat sites",
"main": "src/app.js",
"scripts": {

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) {