@everyone button box reward

This commit is contained in:
legop3
2026-05-15 00:53:40 -04:00
parent 95c2b89875
commit 384f97cdcf
5 changed files with 42 additions and 4 deletions
@@ -0,0 +1,17 @@
// Reward Definition: Discord Ping @everyone
// Purpose: Defines the Discord reward that pings @everyone in general. Scope: Provides reward metadata and dispatch parameters for integration handlers.
module.exports = {
id: 'discordPingEveryone',
name: 'PING @EVERYONE',
goal: 7567,
async run(ctx) {
ctx.publishEvent({
source: 'buttonBoxReward',
type: 'buttonBox.discordPingEveryone',
payload: {
message: 'Pinged by button box masher!!',
},
});
ctx.sendAlert({ color: '#ff00e1', title: 'PING @EVERYONE', message: 'Sent @everyone ping to Discord.' });
},
};
+2
View File
@@ -6,6 +6,7 @@ const lightStrobe = require('./definitions/lightStrobe');
const ghostTypingSpam = require('./definitions/ghostTypingSpam');
const darkness = require('./definitions/darkness');
const discordStalkerPing = require('./definitions/discordStalkerPing');
const discordPingEveryone = require('./definitions/discordPingEveryone');
const modeJam = require('./definitions/modeJam');
const assignmentRoulette = require('./definitions/assignmentRoulette');
const chatSpam = require('./definitions/chatSpam');
@@ -17,6 +18,7 @@ const orderedRewards = [
ghostTypingSpam,
darkness,
discordStalkerPing,
discordPingEveryone,
modeJam,
assignmentRoulette,
chatSpam,
@@ -8,7 +8,6 @@ function registerButtonBoxRoute(deps) {
app,
logger,
buttonCount,
getRequestIp,
normalizeIp,
isLocalNetwork,
applyPress,
@@ -21,8 +20,16 @@ function registerButtonBoxRoute(deps) {
return null;
}
function getSocketIp(req) {
return (
req?.socket?.remoteAddress ||
req?.connection?.remoteAddress ||
null
);
}
function denyIfNotLocal(req, res) {
const ip = normalizeIp(getRequestIp(req));
const ip = normalizeIp(getSocketIp(req));
if (isLocalNetwork(ip)) {
return false;
}
@@ -19,7 +19,7 @@ const {
setEntityState: setHomeAssistantEntityState,
setLightsLockedOn: setHomeAssistantLightsLockedOn,
} = require('../homeAssistantService');
const { getRequestIp, isLocalNetwork, normalizeIp } = require('../../helpers/ipResolver');
const { isLocalNetwork, normalizeIp } = require('../../helpers/ipResolver');
const { createButtonBoxStore } = require('./store');
const { createButtonBoxCore } = require('./core');
const { registerButtonBoxRoute } = require('./httpRoute');
@@ -66,7 +66,6 @@ registerButtonBoxRoute({
app,
logger,
buttonCount: BUTTON_COUNT,
getRequestIp,
normalizeIp,
isLocalNetwork,
applyPress: core.applyPress,
@@ -250,6 +250,19 @@ function createBusEventHandler(deps) {
});
break;
}
case 'buttonBox.discordPingEveryone': {
const message = payload?.message ? String(payload.message) : 'Button box chaos reward triggered.';
sendToChannel(
channels.general,
`@everyone ${message}`.trim(),
{
embeds: [buildEmbed({ title: 'Button Box', description: message, color: 0xff3b30, includeSiteUrl: false })],
},
{ parse: ['everyone'] },
false,
);
break;
}
default:
break;
}