diff --git a/src/games/hvacoins/index.js b/src/games/hvacoins/index.js index f6ea28f..7ffc24d 100644 --- a/src/games/hvacoins/index.js +++ b/src/games/hvacoins/index.js @@ -338,7 +338,7 @@ command( command( ['!in'], - '!in ', + 'Post a message in a specific channel: !in ', async ({ args, event }) => { const channel = idFromWord(args[0]) const text = event.text.substring(event.text.indexOf('>') + 1) diff --git a/src/games/hvacoins/utils.js b/src/games/hvacoins/utils.js index d64f7d3..12efb8d 100644 --- a/src/games/hvacoins/utils.js +++ b/src/games/hvacoins/utils.js @@ -1,10 +1,9 @@ const fs = require('fs') -//const jokes = require('../jokes') const achievements = require('./achievements') const buyableItems = require('./buyableItems') const { quackStore, getChaos } = require('./quackstore') -const slack = require("../../slack"); +let jokes let slackUsers const setSlackUsers = users => { slackUsers = users @@ -424,7 +423,7 @@ const shufflePercent = (str, percentOdds) => { } const definitelyShuffle = (str, percentOdds) => { - if (!str) { + if (!str || str.length === 1) { return str } if (!percentOdds) { @@ -617,5 +616,6 @@ module.exports = { updateAll, setSlackAppClientChatUpdate: update => slackAppClientChatUpdate = update, setUpgrades, - setSlackUsers + setSlackUsers, + setJokes: _jokes => jokes = _jokes } diff --git a/src/games/jokes.js b/src/games/jokes.js index 47e198d..87993ab 100644 --- a/src/games/jokes.js +++ b/src/games/jokes.js @@ -1,4 +1,5 @@ const slack = require('../slack') +const { setJokes } = require('../games/hvacoins/utils') // TODO: Move jokes/news into their own files, and let hvacker edit them when !addjoke or !addnews are used const jokes = [ @@ -106,3 +107,5 @@ module.exports = { tellJoke, newsAlert } + +setJokes(module.exports) \ No newline at end of file diff --git a/src/slack/index.js b/src/slack/index.js index 72899df..c141b3a 100644 --- a/src/slack/index.js +++ b/src/slack/index.js @@ -72,7 +72,7 @@ const buildSayPrepend = ({ say, prepend }) => async msg => { }) } -process.once('SIGINT', code => { +process.once('SIGINT', () => { saveGame('SIGINT', true) process.exit() })