Move a bit more config into hvacoins.json and users.json

This commit is contained in:
Sage Vaillancourt 2023-08-03 10:49:02 -04:00
parent 4433c19d04
commit be0b49393f
3 changed files with 16 additions and 29 deletions

View File

@ -221,24 +221,24 @@ const horrorMessages = [
'why why why why why why why why why why why' 'why why why why why why why why why why why'
] ]
if (settings.horrorEnabled) {
command( command(
['!horror'], ['!horror'],
'help help help help help', 'help help help help help',
async ({ event, say }) => { async ({ event, say }) => {
if (!settings.horrorEnabled) {
return
}
if (event.user === slack.users.Admin) { if (event.user === slack.users.Admin) {
return slack.postToTechThermostatChannel(shufflePercent(event.text.substring(7).trim(), getShuffleOdds())) return slack.postToTechThermostatChannel(shufflePercent(event.text.substring(7).trim(), getShuffleOdds()))
} }
horrors.commandCalls ??= 0 horrors.commandCalls ??= 0
horrors.commandCalls += 1 horrors.commandCalls += 1
await slack.messageAdmin(`<@${event.user}> found !horror.`) 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 }) }, { hidden: true })
}
const buildHorrorSay = ({ say, event, commandName, c }) => async message => { const buildHorrorSay = ({ say, event, commandName, c }) => async message => {
const punishmentOffset = event.user === slack.users.Quade ? 0 : 0 const shuffleOdds = getShuffleOdds(99)
const shuffleOdds = getShuffleOdds(punishmentOffset + 99)
if (typeof message === 'string' && commandName !== '!n' && commandName !== '!nfts' && c.condition !== adminOnly.condition) { if (typeof message === 'string' && commandName !== '!n' && commandName !== '!nfts' && c.condition !== adminOnly.condition) {
let shuffled = shufflePercent(message, shuffleOdds) 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 }) => { const messageHandler = async ({ event, say, isRecycle = false, skipCounting }) => {
if (event?.subtype === 'bot_message') { if (event?.subtype === 'bot_message') {
return botMessageHandler({ event, say }) return botMessageHandler({ event, say })
@ -431,8 +421,8 @@ const messageHandler = async ({ event, say, isRecycle = false, skipCounting }) =
}) })
say = async msg => { say = async msg => {
let icon_url = userInfo.user.profile.image_original let icon_url = userInfo.user.profile.image_original
if (cursedPics[event.user]?.length > 0) { if (game.cursedPics[event.user]?.length > 0) {
icon_url = getRandomFromArray(cursedPics[event.user]) icon_url = getRandomFromArray(game.cursedPics[event.user])
} }
trueSay({ trueSay({
text: msg, text: msg,

View File

@ -39,9 +39,6 @@ const lore = [
l(`And the ninth...`), l(`And the ninth...`),
l(`Well, the ninth might actually amount to something.`), l(`Well, the ninth might actually amount to something.`),
l(`https://i.imgur.com/eFreg7Y.gif\n`), 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 }) => { slack.onReaction(async ({ event, say }) => {

View File

@ -41,7 +41,7 @@ const sendHelp = async (say, prefix) => {
text: prefix + text: prefix +
`Sending a message matching any of \`${pollTriggers.join('`, `')}\` will start a temperature poll.\n` + `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' + '\'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 => { process.once('SIGINT', code => {
saveGame(null, true) saveGame('SIGINT', true)
process.exit() process.exit()
}) })
@ -113,11 +113,11 @@ app.event('message', async ({ event, context, client, say }) => {
} }
if (event.user === users.Admin && event.channel === 'D0347Q4H9FE') { if (event.user === users.Admin && event.channel === 'D0347Q4H9FE') {
if (event.text === '!!kill') { if (event.text === '!!kill') {
saveGame(null, true) saveGame('!!kill', true)
process.exit(1) process.exit(1)
} else if (event.text === '!!restart') { } else if (event.text === '!!restart') {
if (Object.entries(activePolls).length === 0) { if (Object.entries(activePolls).length === 0) {
saveGame(null, true) saveGame('!!restart', true)
process.exit(0) process.exit(0)
} else { } else {
await messageAdmin('Restart pending poll completion...') await messageAdmin('Restart pending poll completion...')
@ -215,11 +215,11 @@ app.event('message', async ({ event, context, client, say }) => {
let text let text
if (hotterVotes > colderVotes && hotterVotes > contentVotes) { 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.' text += 'raise the temperature, quack.'
requestTempChange('Hotter') requestTempChange('Hotter')
} else if (colderVotes > hotterVotes && colderVotes > contentVotes) { } 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.' text += 'lower the temperature, quack quack.'
requestTempChange('Colder') requestTempChange('Colder')
} else { } else {
@ -267,9 +267,9 @@ const messageIn = async (channel, optionsOrText) => {
const startPoll = async () => { const startPoll = async () => {
const sent = await postToTechThermostatChannel({ const sent = await postToTechThermostatChannel({
text: `<!here> Temperature poll requested! In ${pollingMinutes} minutes the temperature will be adjusted.\n` + text: `<!here> 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.` + 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!)' (Note that I can't actually change the temperature yet. Make ${users.ThermoController} do it!)`
}) })
await addReactions({ await addReactions({
app, app,