Compare commits
No commits in common. "93ee8f1c170b33d37daee428df0c218b4975d18b" and "5ec5711288aa9a129743b4f0670e6ca8fbf92e0b" have entirely different histories.
93ee8f1c17
...
5ec5711288
|
@ -1,12 +1,12 @@
|
||||||
{
|
{
|
||||||
"name": "schat2-clive",
|
"name": "schat2-clive",
|
||||||
"version": "1.13.0",
|
"version": "1.12.3",
|
||||||
"lockfileVersion": 2,
|
"lockfileVersion": 2,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "schat2-clive",
|
"name": "schat2-clive",
|
||||||
"version": "1.13.0",
|
"version": "1.12.3",
|
||||||
"license": "ISC",
|
"license": "ISC",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"bhttp": "^1.2.8",
|
"bhttp": "^1.2.8",
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "schat2-clive",
|
"name": "schat2-clive",
|
||||||
"version": "1.13.0",
|
"version": "1.12.3",
|
||||||
"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": {
|
||||||
|
|
|
@ -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(style.code('['))}${game.word.split('').concat(Array.from({ length: config.letters.length - game.word.length })).map((letter) => style.bold(style.code(letter?.toUpperCase() || ' '))).join(style.grey(style.code('|')))}${style.grey(style.code(']'))}`; // 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) {
|
||||||
|
|
|
@ -15,10 +15,6 @@ function schatColor(text, color) {
|
||||||
return `{${color}}(${text})`;
|
return `{${color}}(${text})`;
|
||||||
}
|
}
|
||||||
|
|
||||||
function schatCode(text) {
|
|
||||||
return `\`${text}\``;
|
|
||||||
}
|
|
||||||
|
|
||||||
function curate(fn) {
|
function curate(fn) {
|
||||||
return (text) => {
|
return (text) => {
|
||||||
if (text) {
|
if (text) {
|
||||||
|
@ -33,24 +29,16 @@ function bypass(text) {
|
||||||
return text;
|
return text;
|
||||||
}
|
}
|
||||||
|
|
||||||
function shieldMethods(methods) {
|
|
||||||
return Object.fromEntries(Object.entries(methods).map(([key, method]) => [key, curate(method)]));
|
|
||||||
}
|
|
||||||
|
|
||||||
module.exports = (() => {
|
module.exports = (() => {
|
||||||
if (config.platform === 'irc') {
|
if (config.platform === 'irc') {
|
||||||
return shieldMethods({
|
return styles;
|
||||||
...styles,
|
|
||||||
code: bypass,
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (config.platform === 'schat') {
|
if (config.platform === 'schat') {
|
||||||
const methods = {
|
const methods = {
|
||||||
bold: schatBold,
|
bold: curate(schatBold),
|
||||||
italic: schatItalic,
|
italic: curate(schatItalic),
|
||||||
code: schatCode,
|
...Object.fromEntries(Object.entries(config.schatColors).map(([color, value]) => [color, curate((text) => schatColor(text, value))])),
|
||||||
...Object.fromEntries(Object.entries(config.schatColors).map(([color, value]) => [color, (text) => schatColor(text, value)])),
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const handler = {
|
const handler = {
|
||||||
|
@ -59,9 +47,7 @@ module.exports = (() => {
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
const shieldedMethods = shieldMethods(methods);
|
return new Proxy(methods, handler);
|
||||||
|
|
||||||
return new Proxy(shieldedMethods, handler);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
|
|
Loading…
Reference in New Issue