mirror of
https://github.com/legop3/MultiRoombaRover.git
synced 2026-09-18 18:40:47 -04:00
rename old room controls to lights and rename new thing to activity controls
Container image / image (push) Failing after 1m2s
Container image / image (push) Failing after 1m2s
This commit is contained in:
@@ -5,12 +5,12 @@ const { getCommandConfig } = require('../config');
|
||||
function createHaCommand({ homeAssistantActivitiesService: service, config }) {
|
||||
return async function handleHaCommand(message, tokens = []) {
|
||||
const reply = (content) => message.reply({ content, allowedMentions: { parse: [], repliedUser: false } });
|
||||
if (!service) return reply('Home Assistant activities are unavailable.');
|
||||
if (!service) return reply('Activity Controls are unavailable.');
|
||||
const action = String(tokens[0] || 'status').toLowerCase();
|
||||
try {
|
||||
if (action === 'status') {
|
||||
const items = service.getState().items;
|
||||
return reply(items.length ? items.map((item) => `${item.name} (${item.id}): ${item.locked ? 'locked' : 'unlocked'}`).join('\n') : 'No activity items configured.');
|
||||
return reply(items.length ? items.map((item) => `${item.name} (${item.id}): ${item.locked ? 'locked' : 'unlocked'}`).join('\n') : 'No activity control items configured.');
|
||||
}
|
||||
if (!['lock', 'unlock'].includes(action) || tokens.length < 2) {
|
||||
return reply(`Use ${getCommandConfig(config).prefix} ha status, or ha <lock|unlock> <name or entity ID>.`);
|
||||
|
||||
Reference in New Issue
Block a user