Compare commits

..

No commits in common. "0deea0e016be3cbaf4abeff8397f25bf65befec2" and "70ad422dfaecbc3df902cd4242a1db2b400ea331" have entirely different histories.

5 changed files with 9 additions and 40 deletions

View File

@ -3,35 +3,23 @@
module.exports = { module.exports = {
platform: 'schat', platform: 'schat',
user: { user: {
id: 'aisha',
nick: 'aisha', nick: 'aisha',
username: 'Aisha', username: 'Aisha',
realName: 'Aisha', realName: 'Aisha',
}, },
style: { style: {
// color: 'var(--message-56)', color: 'var(--message-56)',
}, },
operators: ['admin'], operators: ['admin'],
server: 'irc.libera.chat', server: 'irc.libera.chat',
port: 6697, port: 6697,
socket: 'ws://127.0.0.1:3000/socket',
api: 'http://127.0.0.1:3000/api',
reconnectDelay: 10, // seconds reconnectDelay: 10, // seconds
prefix: '~', prefix: '~',
labels: true, labels: true,
greeting: 'Hi, I am aisha, your game host!', greeting: 'Hi, I am aisha, your game host!',
usernamePrefix: '@', usernamePrefix: '@',
channels: ['GamesNight'], channels: ['##pendulum'],
games: ['mash', 'trivia', 'letters', 'duck', 'ping', 'say', 'kill'], games: ['mash', 'trivia', 'duck', 'ping', 'say', 'kill'],
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)',
},
trivia: { trivia: {
mode: 'first', // first or timeout mode: 'first', // first or timeout
rounds: 10, rounds: 10,

4
package-lock.json generated
View File

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

View File

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

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) => letter?.toUpperCase() || ' ').join(style.grey(' | '))} ${style.grey(']')}`;
} }
function countLetters(word) { function countLetters(word) {
@ -158,10 +158,6 @@ function onCommand(args, context) {
function onMessage(message, context) { function onMessage(message, context) {
const game = games.get(context.room.id); const game = games.get(context.room.id);
if (message.type !== 'message' || context.user?.id === config.user?.id) { // stop listening to yourself
return;
}
if (game?.state === 'letters') { if (game?.state === 'letters') {
const multi = message.body.match(/\b[vc]{2,}\b/i)?.[0]; const multi = message.body.match(/\b[vc]{2,}\b/i)?.[0];

View File

@ -11,20 +11,6 @@ function schatItalic(text) {
return `*${text}*`; return `*${text}*`;
} }
function schatColor(text, color) {
return `<span style="color: ${color}">${text}</span>`;
}
function curate(fn) {
return (text) => {
if (text) {
return fn(text);
}
return '';
};
}
function bypass(text) { function bypass(text) {
return text; return text;
} }
@ -36,9 +22,8 @@ module.exports = (() => {
if (config.platform === 'schat') { if (config.platform === 'schat') {
const methods = { const methods = {
bold: curate(schatBold), bold: schatBold,
italic: curate(schatItalic), italic: schatItalic,
...Object.fromEntries(Object.entries(config.schatColors).map(([color, value]) => [color, curate((text) => schatColor(text, value))])),
}; };
const handler = { const handler = {