From be0b49393fae39613c5321fcfed783810e791966 Mon Sep 17 00:00:00 2001 From: Sage Vaillancourt Date: Thu, 3 Aug 2023 10:49:02 -0400 Subject: [PATCH] Move a bit more config into hvacoins.json and users.json --- src/games/hvacoins/index.js | 24 +++++++----------------- src/games/hvacoins/lore.js | 3 --- src/slack/index.js | 18 +++++++++--------- 3 files changed, 16 insertions(+), 29 deletions(-) diff --git a/src/games/hvacoins/index.js b/src/games/hvacoins/index.js index 3f27aa0..94b6c23 100644 --- a/src/games/hvacoins/index.js +++ b/src/games/hvacoins/index.js @@ -221,24 +221,24 @@ const horrorMessages = [ 'why why why why why why why why why why why' ] -if (settings.horrorEnabled) { command( ['!horror'], 'help help help help help', async ({ event, say }) => { + if (!settings.horrorEnabled) { + return + } if (event.user === slack.users.Admin) { return slack.postToTechThermostatChannel(shufflePercent(event.text.substring(7).trim(), getShuffleOdds())) } horrors.commandCalls ??= 0 horrors.commandCalls += 1 await slack.messageAdmin(`<@${event.user}> found !horror.`) - await say('_Do you think you can help me?_') // TODO horror horrors change help to !help + await say('_Do you think you can help me?_') }, { hidden: true }) -} const buildHorrorSay = ({ say, event, commandName, c }) => async message => { - const punishmentOffset = event.user === slack.users.Quade ? 0 : 0 - const shuffleOdds = getShuffleOdds(punishmentOffset + 99) + const shuffleOdds = getShuffleOdds(99) if (typeof message === 'string' && commandName !== '!n' && commandName !== '!nfts' && c.condition !== adminOnly.condition) { let shuffled = shufflePercent(message, shuffleOdds) @@ -364,16 +364,6 @@ command( } ) -const cursedPics = { - U0B8W0AF3: ['https://i.imgur.com/UNYKS0c.png'], //'Charles', - //U0B8RTK5L: '', //'Zane', - U02KYLVK1GV: ['https://i.imgur.com/VTSob8w.png', 'https://i.imgur.com/BdXqA5d.jpeg'], //'Quade', - UTDLFGZA5: ['https://i.imgur.com/YIrz4JQ.png'], // 'Tyler', - U017PG4EL1Y: ['https://i.imgur.com/d65EuaQ.png'],//'Max', - // hole viscera - U02AAB54V34: ['https://i.imgur.com/ewT3AoL.png', 'https://i.imgur.com/LLyzybV.png'] // 'Houston' -} - const messageHandler = async ({ event, say, isRecycle = false, skipCounting }) => { if (event?.subtype === 'bot_message') { return botMessageHandler({ event, say }) @@ -431,8 +421,8 @@ const messageHandler = async ({ event, say, isRecycle = false, skipCounting }) = }) say = async msg => { let icon_url = userInfo.user.profile.image_original - if (cursedPics[event.user]?.length > 0) { - icon_url = getRandomFromArray(cursedPics[event.user]) + if (game.cursedPics[event.user]?.length > 0) { + icon_url = getRandomFromArray(game.cursedPics[event.user]) } trueSay({ text: msg, diff --git a/src/games/hvacoins/lore.js b/src/games/hvacoins/lore.js index 849354c..ad6585d 100644 --- a/src/games/hvacoins/lore.js +++ b/src/games/hvacoins/lore.js @@ -39,9 +39,6 @@ const lore = [ l(`And the ninth...`), l(`Well, the ninth might actually amount to something.`), l(`https://i.imgur.com/eFreg7Y.gif\n`), - - //l(`As you might imagine, the ninth egg was I, the almighty Hvacker.`) - // In due time, the ninth egg (I, the almighty Hvacker) ] slack.onReaction(async ({ event, say }) => { diff --git a/src/slack/index.js b/src/slack/index.js index 65f487a..3ddcb65 100644 --- a/src/slack/index.js +++ b/src/slack/index.js @@ -41,7 +41,7 @@ const sendHelp = async (say, prefix) => { text: prefix + `Sending a message matching any of \`${pollTriggers.join('`, `')}\` will start a temperature poll.\n` + '\'Hotter\' and \'Colder\' votes offset. E.g. with votes Hotter - 4, Colder - 3, and Content - 2, the temp won\'t change.\n' + - 'At this time I am not capable of actually changing the temperature. Go bug Michael.' + `At this time I am not capable of actually changing the temperature. Go bug ${users.ThermoController}.` }) } @@ -73,7 +73,7 @@ const buildSayPrepend = ({ say, prepend }) => async msg => { } process.once('SIGINT', code => { - saveGame(null, true) + saveGame('SIGINT', true) process.exit() }) @@ -113,11 +113,11 @@ app.event('message', async ({ event, context, client, say }) => { } if (event.user === users.Admin && event.channel === 'D0347Q4H9FE') { if (event.text === '!!kill') { - saveGame(null, true) + saveGame('!!kill', true) process.exit(1) } else if (event.text === '!!restart') { if (Object.entries(activePolls).length === 0) { - saveGame(null, true) + saveGame('!!restart', true) process.exit(0) } else { await messageAdmin('Restart pending poll completion...') @@ -215,11 +215,11 @@ app.event('message', async ({ event, context, client, say }) => { let text if (hotterVotes > colderVotes && hotterVotes > contentVotes) { - text = `<@${users.Michael}> The people have spoken, and would like to ` + text = `<@${users[users.ThermoController]}> The people have spoken, and would like to ` text += 'raise the temperature, quack.' requestTempChange('Hotter') } else if (colderVotes > hotterVotes && colderVotes > contentVotes) { - text = `<@${users.Michael}> The people have spoken, and would like to ` + text = `<@${users[users.ThermoController]}> The people have spoken, and would like to ` text += 'lower the temperature, quack quack.' requestTempChange('Colder') } else { @@ -267,9 +267,9 @@ const messageIn = async (channel, optionsOrText) => { const startPoll = async () => { const sent = await postToTechThermostatChannel({ - text: ` Temperature poll requested! In ${pollingMinutes} minutes the temperature will be adjusted.\n` + - `Pick :${colderEmoji}: if you want it colder, :${hotterEmoji}: if you want it hotter, or :${goodEmoji}: if you like it how it is.` + - '\n(Note that I can\'t actually change the temperature yet. Make Michael do it!)' + text: ` Temperature poll requested! In ${pollingMinutes} minutes the temperature will be adjusted. +Pick :${colderEmoji}: if you want it colder, :${hotterEmoji}: if you want it hotter, or :${goodEmoji}: if you like it how it is. +(Note that I can't actually change the temperature yet. Make ${users.ThermoController} do it!)` }) await addReactions({ app,