Compare commits

...

2 Commits

Author SHA1 Message Date
ThePendulum c63f05fcf5 1.16.1 2022-10-24 02:10:10 +02:00
ThePendulum f9708a1a77 Filtering out unavailable commands from help. 2022-10-24 02:10:07 +02:00
4 changed files with 11 additions and 5 deletions

4
package-lock.json generated
View File

@ -1,12 +1,12 @@
{ {
"name": "schat2-clive", "name": "schat2-clive",
"version": "1.16.0", "version": "1.16.1",
"lockfileVersion": 2, "lockfileVersion": 2,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "schat2-clive", "name": "schat2-clive",
"version": "1.16.0", "version": "1.16.1",
"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.16.0", "version": "1.16.1",
"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

@ -4,8 +4,13 @@ const config = require('config');
const { version } = require('../../package.json'); const { version } = require('../../package.json');
function onCommand(args, context) { function onCommand(args, context) {
const commandsByGame = Object.entries(context.games).reduce((acc, [command, game]) => ({ ...acc, [game.name]: [...(acc[game.name] || []), command] }), {}); const commandsByGame = Object.entries(context.games)
const commands = Object.entries(commandsByGame).map(([gameName, gameCommands]) => `${gameName.slice(0, 1).toUpperCase()}${gameName.slice(1)}: ${gameCommands.map((command) => `${config.prefix}${command}`).join(', ')}`).join(' | '); .filter(([command, game]) => !command.includes('-') && !game.restricted)
.reduce((acc, [command, game]) => ({ ...acc, [game.name]: [...(acc[game.name] || []), command] }), {});
const commands = Object.entries(commandsByGame)
.map(([gameName, gameCommands]) => `${gameName.slice(0, 1).toUpperCase()}${gameName.slice(1)}: ${gameCommands.map((command) => `${config.prefix}${command}`).join(', ')}`)
.join(' | ');
context.sendMessage(`${commands}`, context.room.id, { styleCommands: true }); context.sendMessage(`${commands}`, context.room.id, { styleCommands: true });
context.sendMessage(`Try ${config.prefix}game:help for more info, ${config.prefix}game:score [username] and ${config.prefix}game:lead for scores. | ${config.user.username} v${version} `, context.room.id, { styleCommands: true }); context.sendMessage(`Try ${config.prefix}game:help for more info, ${config.prefix}game:score [username] and ${config.prefix}game:lead for scores. | ${config.user.username} v${version} `, context.room.id, { styleCommands: true });

View File

@ -39,4 +39,5 @@ function onCommand(args, context) {
module.exports = { module.exports = {
name: 'Say', name: 'Say',
onCommand, onCommand,
restricted: true,
}; };