Some cleanup and corrections.

Jokes and news should work again
This commit is contained in:
Sage Vaillancourt 2023-12-31 20:29:39 -05:00
parent 02256dede6
commit 7bc1455e37
4 changed files with 9 additions and 6 deletions

View File

@ -338,7 +338,7 @@ command(
command(
['!in'],
'!in <channel> <message>',
'Post a message in a specific channel: !in <channel> <message>',
async ({ args, event }) => {
const channel = idFromWord(args[0])
const text = event.text.substring(event.text.indexOf('>') + 1)

View File

@ -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
}

View File

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

View File

@ -72,7 +72,7 @@ const buildSayPrepend = ({ say, prepend }) => async msg => {
})
}
process.once('SIGINT', code => {
process.once('SIGINT', () => {
saveGame('SIGINT', true)
process.exit()
})