mirror of
https://github.com/legop3/MultiRoombaRover.git
synced 2026-09-15 17:12:59 -04:00
@everyone button box reward
This commit is contained in:
@@ -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.' });
|
||||||
|
},
|
||||||
|
};
|
||||||
@@ -6,6 +6,7 @@ const lightStrobe = require('./definitions/lightStrobe');
|
|||||||
const ghostTypingSpam = require('./definitions/ghostTypingSpam');
|
const ghostTypingSpam = require('./definitions/ghostTypingSpam');
|
||||||
const darkness = require('./definitions/darkness');
|
const darkness = require('./definitions/darkness');
|
||||||
const discordStalkerPing = require('./definitions/discordStalkerPing');
|
const discordStalkerPing = require('./definitions/discordStalkerPing');
|
||||||
|
const discordPingEveryone = require('./definitions/discordPingEveryone');
|
||||||
const modeJam = require('./definitions/modeJam');
|
const modeJam = require('./definitions/modeJam');
|
||||||
const assignmentRoulette = require('./definitions/assignmentRoulette');
|
const assignmentRoulette = require('./definitions/assignmentRoulette');
|
||||||
const chatSpam = require('./definitions/chatSpam');
|
const chatSpam = require('./definitions/chatSpam');
|
||||||
@@ -17,6 +18,7 @@ const orderedRewards = [
|
|||||||
ghostTypingSpam,
|
ghostTypingSpam,
|
||||||
darkness,
|
darkness,
|
||||||
discordStalkerPing,
|
discordStalkerPing,
|
||||||
|
discordPingEveryone,
|
||||||
modeJam,
|
modeJam,
|
||||||
assignmentRoulette,
|
assignmentRoulette,
|
||||||
chatSpam,
|
chatSpam,
|
||||||
|
|||||||
@@ -8,7 +8,6 @@ function registerButtonBoxRoute(deps) {
|
|||||||
app,
|
app,
|
||||||
logger,
|
logger,
|
||||||
buttonCount,
|
buttonCount,
|
||||||
getRequestIp,
|
|
||||||
normalizeIp,
|
normalizeIp,
|
||||||
isLocalNetwork,
|
isLocalNetwork,
|
||||||
applyPress,
|
applyPress,
|
||||||
@@ -21,8 +20,16 @@ function registerButtonBoxRoute(deps) {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getSocketIp(req) {
|
||||||
|
return (
|
||||||
|
req?.socket?.remoteAddress ||
|
||||||
|
req?.connection?.remoteAddress ||
|
||||||
|
null
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
function denyIfNotLocal(req, res) {
|
function denyIfNotLocal(req, res) {
|
||||||
const ip = normalizeIp(getRequestIp(req));
|
const ip = normalizeIp(getSocketIp(req));
|
||||||
if (isLocalNetwork(ip)) {
|
if (isLocalNetwork(ip)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ const {
|
|||||||
setEntityState: setHomeAssistantEntityState,
|
setEntityState: setHomeAssistantEntityState,
|
||||||
setLightsLockedOn: setHomeAssistantLightsLockedOn,
|
setLightsLockedOn: setHomeAssistantLightsLockedOn,
|
||||||
} = require('../homeAssistantService');
|
} = require('../homeAssistantService');
|
||||||
const { getRequestIp, isLocalNetwork, normalizeIp } = require('../../helpers/ipResolver');
|
const { isLocalNetwork, normalizeIp } = require('../../helpers/ipResolver');
|
||||||
const { createButtonBoxStore } = require('./store');
|
const { createButtonBoxStore } = require('./store');
|
||||||
const { createButtonBoxCore } = require('./core');
|
const { createButtonBoxCore } = require('./core');
|
||||||
const { registerButtonBoxRoute } = require('./httpRoute');
|
const { registerButtonBoxRoute } = require('./httpRoute');
|
||||||
@@ -66,7 +66,6 @@ registerButtonBoxRoute({
|
|||||||
app,
|
app,
|
||||||
logger,
|
logger,
|
||||||
buttonCount: BUTTON_COUNT,
|
buttonCount: BUTTON_COUNT,
|
||||||
getRequestIp,
|
|
||||||
normalizeIp,
|
normalizeIp,
|
||||||
isLocalNetwork,
|
isLocalNetwork,
|
||||||
applyPress: core.applyPress,
|
applyPress: core.applyPress,
|
||||||
|
|||||||
@@ -250,6 +250,19 @@ function createBusEventHandler(deps) {
|
|||||||
});
|
});
|
||||||
break;
|
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:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user