Linting
This commit is contained in:
@@ -1,11 +1,11 @@
|
||||
import { DebugBuilder } from "../../modules/debugger.mjs";
|
||||
const log = new DebugBuilder("server", "discordBot.command.ping");
|
||||
import { SlashCommandBuilder } from 'discord.js';
|
||||
import { SlashCommandBuilder } from "discord.js";
|
||||
|
||||
// Exporting data property that contains the command structure for discord including any params
|
||||
export const data = new SlashCommandBuilder()
|
||||
.setName('connections')
|
||||
.setDescription('Check to see what bots are online.');
|
||||
.setName("connections")
|
||||
.setDescription("Check to see what bots are online.");
|
||||
|
||||
// Exporting other properties
|
||||
export const example = "/connections"; // An example of how the command would be run in discord chat, this will be used for the help command
|
||||
@@ -33,20 +33,20 @@ export async function autocomplete(nodeIo, interaction) {
|
||||
*/
|
||||
export const execute = async (nodeIo, interaction) => {
|
||||
try {
|
||||
const sockets = await nodeIo.allSockets();
|
||||
log.DEBUG("All open sockets: ",sockets);
|
||||
let socketMessage = "";
|
||||
|
||||
// Create the message for discord with each socket on a new line
|
||||
sockets.forEach(socket => {
|
||||
socketMessage += `\n${socket}`
|
||||
});
|
||||
const sockets = await nodeIo.allSockets();
|
||||
log.DEBUG("All open sockets: ", sockets);
|
||||
let socketMessage = "";
|
||||
|
||||
await interaction.reply(`**Online Sockets: '${socketMessage}'**`);
|
||||
//await interaction.reply('**Pong.**');
|
||||
//await interaction.channel.send('**Pong.**');
|
||||
// Create the message for discord with each socket on a new line
|
||||
sockets.forEach((socket) => {
|
||||
socketMessage += `\n${socket}`;
|
||||
});
|
||||
|
||||
await interaction.reply(`**Online Sockets: '${socketMessage}'**`);
|
||||
//await interaction.reply('**Pong.**');
|
||||
//await interaction.channel.send('**Pong.**');
|
||||
} catch (err) {
|
||||
console.error(err);
|
||||
// await interaction.reply(err.toString());
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1,19 +1,28 @@
|
||||
import { DebugBuilder } from "../../modules/debugger.mjs";
|
||||
import { SlashCommandBuilder } from 'discord.js';
|
||||
import { joinNode, getAvailableNodes, promptNodeSelection, getUserVoiceChannel } from '../modules/wrappers.mjs';
|
||||
import { getAllSystems, getSystemByName } from '../../modules/mongo-wrappers/mongoSystemsWrappers.mjs';
|
||||
import { SlashCommandBuilder } from "discord.js";
|
||||
import {
|
||||
joinNode,
|
||||
getAvailableNodes,
|
||||
promptNodeSelection,
|
||||
getUserVoiceChannel,
|
||||
} from "../modules/wrappers.mjs";
|
||||
import {
|
||||
getAllSystems,
|
||||
getSystemByName,
|
||||
} from "../../modules/mongo-wrappers/mongoSystemsWrappers.mjs";
|
||||
|
||||
const log = new DebugBuilder("server", "discordBot.command.join");
|
||||
|
||||
// Exporting data property
|
||||
export const data = new SlashCommandBuilder()
|
||||
.setName('join')
|
||||
.setDescription('Listen to the selected radio system in your channel')
|
||||
.addStringOption(system =>
|
||||
system.setName('system')
|
||||
.setDescription('The radio system you would like to listen to')
|
||||
.setName("join")
|
||||
.setDescription("Listen to the selected radio system in your channel")
|
||||
.addStringOption((system) =>
|
||||
system
|
||||
.setName("system")
|
||||
.setDescription("The radio system you would like to listen to")
|
||||
.setRequired(true)
|
||||
.setAutocomplete(true)
|
||||
.setAutocomplete(true),
|
||||
);
|
||||
|
||||
// Exporting other properties
|
||||
@@ -28,16 +37,17 @@ export const deferInitialReply = true;
|
||||
export async function autocomplete(nodeIo, interaction) {
|
||||
const focusedValue = interaction.options.getFocused();
|
||||
const choices = await getAllSystems();
|
||||
const filtered = choices.filter(choice => choice.name.startsWith(focusedValue));
|
||||
const filtered = choices.filter((choice) =>
|
||||
choice.name.startsWith(focusedValue),
|
||||
);
|
||||
|
||||
log.DEBUG(focusedValue, choices, filtered);
|
||||
|
||||
try {
|
||||
await interaction.respond(
|
||||
filtered.map(choice => ({ name: choice.name, value: choice.name }))
|
||||
filtered.map((choice) => ({ name: choice.name, value: choice.name })),
|
||||
);
|
||||
}
|
||||
catch (e) {
|
||||
} catch (e) {
|
||||
log.WARN("Autocomplete interaction failure", e);
|
||||
}
|
||||
}
|
||||
@@ -54,40 +64,66 @@ export async function execute(nodeIo, interaction) {
|
||||
if (!channelToJoin) return;
|
||||
|
||||
// Get the selected system
|
||||
const selectedSystemName = interaction.options.getString('system');
|
||||
const selectedSystemName = interaction.options.getString("system");
|
||||
const system = await getSystemByName(selectedSystemName);
|
||||
|
||||
// Check if there was a system found by the given system name
|
||||
if (!system) {
|
||||
await interaction.editReply({ content: `System '${selectedSystemName}' not found.`, ephemeral: true });
|
||||
await interaction.editReply({
|
||||
content: `System '${selectedSystemName}' not found.`,
|
||||
ephemeral: true,
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
// Get the available nodes for this system
|
||||
const availableNodes = await getAvailableNodes(nodeIo, interaction.guild.id, system);
|
||||
const availableNodes = await getAvailableNodes(
|
||||
nodeIo,
|
||||
interaction.guild.id,
|
||||
system,
|
||||
);
|
||||
|
||||
// Check if there are available nodes
|
||||
if (availableNodes.length === 0) {
|
||||
// If not, let the user know
|
||||
await interaction.editReply(`<@${interaction.member.id}>, the selected system has no available nodes`);
|
||||
await interaction.editReply(
|
||||
`<@${interaction.member.id}>, the selected system has no available nodes`,
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
// If there is one available node, request that node join
|
||||
if (availableNodes.length === 1) {
|
||||
await joinNode(nodeIo, interaction, availableNodes[0].id, system, channelToJoin);
|
||||
await joinNode(
|
||||
nodeIo,
|
||||
interaction,
|
||||
availableNodes[0].id,
|
||||
system,
|
||||
channelToJoin,
|
||||
);
|
||||
}
|
||||
|
||||
// If there are more than one available, prompt the user for their selected node
|
||||
else {
|
||||
await promptNodeSelection(interaction, availableNodes, async selectedNode => {
|
||||
await joinNode(nodeIo, interaction, selectedNode, system, channelToJoin);
|
||||
});
|
||||
await promptNodeSelection(
|
||||
interaction,
|
||||
availableNodes,
|
||||
async (selectedNode) => {
|
||||
await joinNode(
|
||||
nodeIo,
|
||||
interaction,
|
||||
selectedNode,
|
||||
system,
|
||||
channelToJoin,
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
catch (err) {
|
||||
} catch (err) {
|
||||
log.ERROR(err);
|
||||
await interaction.editReply({ content: `An error occurred: ${err.message}`, ephemeral: true });
|
||||
await interaction.editReply({
|
||||
content: `An error occurred: ${err.message}`,
|
||||
ephemeral: true,
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,19 +1,23 @@
|
||||
import { DebugBuilder } from "../../modules/debugger.mjs";
|
||||
import { SlashCommandBuilder } from 'discord.js';
|
||||
import { requestBotLeaveServer, getSocketIdByNuid } from '../../modules/socketServerWrappers.mjs';
|
||||
import { checkOnlineBotsInGuild } from '../modules/wrappers.mjs';
|
||||
import { SlashCommandBuilder } from "discord.js";
|
||||
import {
|
||||
requestBotLeaveServer,
|
||||
getSocketIdByNuid,
|
||||
} from "../../modules/socketServerWrappers.mjs";
|
||||
import { checkOnlineBotsInGuild } from "../modules/wrappers.mjs";
|
||||
|
||||
const log = new DebugBuilder("server", "discordBot.command.leave");
|
||||
|
||||
// Exporting data property
|
||||
export const data = new SlashCommandBuilder()
|
||||
.setName('leave')
|
||||
.setDescription('Disconnect a bot from the server')
|
||||
.addStringOption(system =>
|
||||
system.setName('bot')
|
||||
.setDescription('The bot you would like to disconnect')
|
||||
.setName("leave")
|
||||
.setDescription("Disconnect a bot from the server")
|
||||
.addStringOption((system) =>
|
||||
system
|
||||
.setName("bot")
|
||||
.setDescription("The bot you would like to disconnect")
|
||||
.setRequired(true)
|
||||
.setAutocomplete(true)
|
||||
.setAutocomplete(true),
|
||||
);
|
||||
|
||||
// Exporting other properties
|
||||
@@ -32,15 +36,14 @@ export async function autocomplete(nodeIo, interaction) {
|
||||
log.DEBUG(choices);
|
||||
|
||||
const filtered = choices
|
||||
.filter(choice => choice.name.startsWith(focusedValue))
|
||||
.map(choice => ({ name: choice.name, value: choice.nuid }));
|
||||
.filter((choice) => choice.name.startsWith(focusedValue))
|
||||
.map((choice) => ({ name: choice.name, value: choice.nuid }));
|
||||
|
||||
log.DEBUG(focusedValue, choices, filtered);
|
||||
|
||||
try{
|
||||
try {
|
||||
await interaction.respond(filtered);
|
||||
}
|
||||
catch (e) {
|
||||
} catch (e) {
|
||||
log.WARN("Autocomplete interaction failure", e);
|
||||
}
|
||||
}
|
||||
@@ -52,19 +55,27 @@ export async function autocomplete(nodeIo, interaction) {
|
||||
*/
|
||||
export async function execute(nodeIo, interaction) {
|
||||
try {
|
||||
const selectedNode = interaction.options.getString('bot');
|
||||
const selectedNode = interaction.options.getString("bot");
|
||||
const socket = await getSocketIdByNuid(nodeIo, selectedNode);
|
||||
|
||||
if (!socket) {
|
||||
await interaction.editReply({ content: `Bot '${selectedNode}' not found or not connected.`, ephemeral: true });
|
||||
await interaction.editReply({
|
||||
content: `Bot '${selectedNode}' not found or not connected.`,
|
||||
ephemeral: true,
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
await requestBotLeaveServer(socket, interaction.guild.id);
|
||||
|
||||
await interaction.editReply(`Ok <@${interaction.member.id}>, the bot is leaving shortly.`);
|
||||
await interaction.editReply(
|
||||
`Ok <@${interaction.member.id}>, the bot is leaving shortly.`,
|
||||
);
|
||||
} catch (err) {
|
||||
log.ERROR("Failed to disconnect bot:", err);
|
||||
await interaction.editReply({ content: `An error occurred: ${err.message}`, ephemeral: true });
|
||||
await interaction.editReply({
|
||||
content: `An error occurred: ${err.message}`,
|
||||
ephemeral: true,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
import { DebugBuilder } from "../../modules/debugger.mjs";
|
||||
const log = new DebugBuilder("server", "discordBot.command.ping");
|
||||
import { SlashCommandBuilder } from 'discord.js';
|
||||
import { SlashCommandBuilder } from "discord.js";
|
||||
|
||||
// Exporting data property that contains the command structure for discord including any params
|
||||
export const data = new SlashCommandBuilder()
|
||||
.setName('ping')
|
||||
.setDescription('Replies with your input!');
|
||||
.setName("ping")
|
||||
.setDescription("Replies with your input!");
|
||||
|
||||
// Exporting other properties
|
||||
export const example = "/ping"; // An example of how the command would be run in discord chat, this will be used for the help command
|
||||
@@ -33,13 +33,13 @@ export async function autocomplete(nodeIo, interaction) {
|
||||
*/
|
||||
export const execute = async (nodeIo, interaction) => {
|
||||
try {
|
||||
const sockets = await nodeIo.allSockets();
|
||||
log.DEBUG("All open sockets: ",sockets);
|
||||
//await interaction.reply(`**Online Sockets: '${sockets}'**`);
|
||||
await interaction.reply('**Pong.**');
|
||||
//await interaction.channel.send('**Pong.**');
|
||||
const sockets = await nodeIo.allSockets();
|
||||
log.DEBUG("All open sockets: ", sockets);
|
||||
//await interaction.reply(`**Online Sockets: '${sockets}'**`);
|
||||
await interaction.reply("**Pong.**");
|
||||
//await interaction.channel.send('**Pong.**');
|
||||
} catch (err) {
|
||||
console.error(err);
|
||||
// await interaction.reply(err.toString());
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1,28 +1,34 @@
|
||||
|
||||
import { SlashCommandBuilder } from 'discord.js';
|
||||
import { SlashCommandBuilder } from "discord.js";
|
||||
import { DebugBuilder } from "../../modules/debugger.mjs";
|
||||
import { addSource } from '../../rss-manager/sourceManager.mjs'
|
||||
import { addSource } from "../../rss-manager/sourceManager.mjs";
|
||||
const log = new DebugBuilder("server", "discordBot.command.rssAdd");
|
||||
|
||||
// Exporting data property that contains the command structure for discord including any params
|
||||
export const data = new SlashCommandBuilder()
|
||||
.setName('rss-add')
|
||||
.setDescription('Add RSS Source')
|
||||
.addStringOption(option =>
|
||||
option.setName('title')
|
||||
.setDescription('The title of the RSS feed')
|
||||
.setRequired(true))
|
||||
.addStringOption(option =>
|
||||
option.setName('link')
|
||||
.setDescription('The link to the RSS feed')
|
||||
.setRequired(true))
|
||||
.addStringOption(option =>
|
||||
option.setName('category')
|
||||
.setName("rss-add")
|
||||
.setDescription("Add RSS Source")
|
||||
.addStringOption((option) =>
|
||||
option
|
||||
.setName("title")
|
||||
.setDescription("The title of the RSS feed")
|
||||
.setRequired(true),
|
||||
)
|
||||
.addStringOption((option) =>
|
||||
option
|
||||
.setName("link")
|
||||
.setDescription("The link to the RSS feed")
|
||||
.setRequired(true),
|
||||
)
|
||||
.addStringOption((option) =>
|
||||
option
|
||||
.setName("category")
|
||||
.setDescription('The category for the RSS feed *("ALL" by default")*')
|
||||
.setRequired(false))
|
||||
.setRequired(false),
|
||||
);
|
||||
|
||||
// Exporting other properties
|
||||
export const example = "/rss-add [title] [https://domain.com/feed.xml] [category]"; // An example of how the command would be run in discord chat, this will be used for the help command
|
||||
export const example =
|
||||
"/rss-add [title] [https://domain.com/feed.xml] [category]"; // An example of how the command would be run in discord chat, this will be used for the help command
|
||||
export const deferInitialReply = false; // If we the initial reply in discord should be deferred. This gives extra time to respond, however the method of replying is different.
|
||||
|
||||
/**
|
||||
@@ -49,24 +55,37 @@ export async function autocomplete(nodeIo, interaction) {
|
||||
*/
|
||||
export const execute = async (nodeIo, interaction) => {
|
||||
try {
|
||||
var title = interaction.options.getString('title');
|
||||
var link = interaction.options.getString('link');
|
||||
var category = interaction.options.getString('category');
|
||||
var title = interaction.options.getString("title");
|
||||
var link = interaction.options.getString("link");
|
||||
var category = interaction.options.getString("category");
|
||||
|
||||
if (!category) category = "ALL";
|
||||
await interaction.reply(`Adding ${title} to the list of RSS sources, please wait...`);
|
||||
await interaction.reply(
|
||||
`Adding ${title} to the list of RSS sources, please wait...`,
|
||||
);
|
||||
|
||||
await addSource(title, link, category, interaction.guildId, interaction.channelId, (err, result) => {
|
||||
log.DEBUG("Result from adding entry", result);
|
||||
await addSource(
|
||||
title,
|
||||
link,
|
||||
category,
|
||||
interaction.guildId,
|
||||
interaction.channelId,
|
||||
(err, result) => {
|
||||
log.DEBUG("Result from adding entry", result);
|
||||
|
||||
if (result) {
|
||||
interaction.editReply(`Successfully added ${title} to the list of RSS sources`);
|
||||
} else {
|
||||
interaction.editReply(`${title} already exists in the list of RSS sources`);
|
||||
}
|
||||
});
|
||||
if (result) {
|
||||
interaction.editReply(
|
||||
`Successfully added ${title} to the list of RSS sources`,
|
||||
);
|
||||
} else {
|
||||
interaction.editReply(
|
||||
`${title} already exists in the list of RSS sources`,
|
||||
);
|
||||
}
|
||||
},
|
||||
);
|
||||
} catch (err) {
|
||||
log.ERROR(err)
|
||||
log.ERROR(err);
|
||||
await interaction.editReply(err.toString());
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1,19 +1,23 @@
|
||||
|
||||
import { SlashCommandBuilder } from 'discord.js';
|
||||
import { SlashCommandBuilder } from "discord.js";
|
||||
import { DebugBuilder } from "../../modules/debugger.mjs";
|
||||
import { removeSource } from '../../rss-manager/sourceManager.mjs'
|
||||
import { getAllFeeds, deleteFeedByTitle } from '../../modules/mongo-wrappers/mongoFeedsWrappers.mjs'
|
||||
import { removeSource } from "../../rss-manager/sourceManager.mjs";
|
||||
import {
|
||||
getAllFeeds,
|
||||
deleteFeedByTitle,
|
||||
} from "../../modules/mongo-wrappers/mongoFeedsWrappers.mjs";
|
||||
const log = new DebugBuilder("server", "discordBot.command.rssRemove");
|
||||
|
||||
// Exporting data property that contains the command structure for discord including any params
|
||||
export const data = new SlashCommandBuilder()
|
||||
.setName('rss-remove')
|
||||
.setDescription('Add RSS Source')
|
||||
.addStringOption(option =>
|
||||
option.setName('title')
|
||||
.setDescription('The title of the RSS feed')
|
||||
.setName("rss-remove")
|
||||
.setDescription("Add RSS Source")
|
||||
.addStringOption((option) =>
|
||||
option
|
||||
.setName("title")
|
||||
.setDescription("The title of the RSS feed")
|
||||
.setRequired(true)
|
||||
.setAutocomplete(true))
|
||||
.setAutocomplete(true),
|
||||
);
|
||||
|
||||
// Exporting other properties
|
||||
export const example = "/rss-remove [title]"; // An example of how the command would be run in discord chat, this will be used for the help command
|
||||
@@ -27,11 +31,15 @@ export const deferInitialReply = false; // If we the initial reply in discord sh
|
||||
|
||||
export async function autocomplete(nodeIo, interaction) {
|
||||
const focusedValue = interaction.options.getFocused();
|
||||
const choices = await getAllFeeds() ?? [];
|
||||
const choices = (await getAllFeeds()) ?? [];
|
||||
log.INFO("RSS Remove Choices:", choices);
|
||||
const filtered = choices.filter(choice => choice.title.startsWith(focusedValue));
|
||||
const filtered = choices.filter((choice) =>
|
||||
choice.title.startsWith(focusedValue),
|
||||
);
|
||||
log.DEBUG(focusedValue, choices, filtered);
|
||||
await interaction.respond(filtered.map(choice => ({ name: choice.title, value: choice.title })));
|
||||
await interaction.respond(
|
||||
filtered.map((choice) => ({ name: choice.title, value: choice.title })),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -41,8 +49,10 @@ export async function autocomplete(nodeIo, interaction) {
|
||||
*/
|
||||
export const execute = async (nodeIo, interaction) => {
|
||||
try {
|
||||
var title = interaction.options.getString('title');
|
||||
await interaction.reply(`Removing ${title} from the list of RSS sources, please wait...`);
|
||||
var title = interaction.options.getString("title");
|
||||
await interaction.reply(
|
||||
`Removing ${title} from the list of RSS sources, please wait...`,
|
||||
);
|
||||
|
||||
const results = await deleteFeedByTitle(title);
|
||||
if (!results) {
|
||||
@@ -50,9 +60,11 @@ export const execute = async (nodeIo, interaction) => {
|
||||
await interaction.editReply(`Failed to remove source: '${title}'`);
|
||||
return;
|
||||
}
|
||||
await interaction.editReply(`${title} was successfully removed from the RSS sources.`)
|
||||
await interaction.editReply(
|
||||
`${title} was successfully removed from the RSS sources.`,
|
||||
);
|
||||
} catch (err) {
|
||||
log.ERROR(err)
|
||||
log.ERROR(err);
|
||||
await interaction.editReply(err.toString());
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
import { DebugBuilder } from "../../modules/debugger.mjs";
|
||||
const log = new DebugBuilder("server", "discordBot.command.rssTrigger");
|
||||
import { SlashCommandBuilder } from 'discord.js';
|
||||
import { updateFeeds } from '../../rss-manager/feedHandler.mjs'
|
||||
import { SlashCommandBuilder } from "discord.js";
|
||||
import { updateFeeds } from "../../rss-manager/feedHandler.mjs";
|
||||
|
||||
// Exporting data property that contains the command structure for discord including any params
|
||||
export const data = new SlashCommandBuilder()
|
||||
.setName('rss-trigger')
|
||||
.setDescription('Manually triggers an RSS feed update');
|
||||
.setName("rss-trigger")
|
||||
.setDescription("Manually triggers an RSS feed update");
|
||||
|
||||
// Exporting other properties
|
||||
export const example = "/rss-trigger"; // An example of how the command would be run in discord chat, this will be used for the help command
|
||||
@@ -33,15 +33,15 @@ export async function autocomplete(nodeIo, interaction) {
|
||||
* @param {any} interaction The interaction object
|
||||
*/
|
||||
export const execute = async (nodeIo, interaction) => {
|
||||
try {
|
||||
//const sockets = await nodeIo.allSockets();
|
||||
//await interaction.reply(`**Online Sockets: '${sockets}'**`);
|
||||
await interaction.reply('Triggering RSS update');
|
||||
await updateFeeds(interaction.client);
|
||||
await interaction.editReply('RSS Update Completed');
|
||||
//await interaction.channel.send('**Pong.**');
|
||||
} catch (err) {
|
||||
console.error(err);
|
||||
// await interaction.reply(err.toString());
|
||||
}
|
||||
}
|
||||
try {
|
||||
//const sockets = await nodeIo.allSockets();
|
||||
//await interaction.reply(`**Online Sockets: '${sockets}'**`);
|
||||
await interaction.reply("Triggering RSS update");
|
||||
await updateFeeds(interaction.client);
|
||||
await interaction.editReply("RSS Update Completed");
|
||||
//await interaction.channel.send('**Pong.**');
|
||||
} catch (err) {
|
||||
console.error(err);
|
||||
// await interaction.reply(err.toString());
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
import { DebugBuilder } from "../../modules/debugger.mjs";
|
||||
const log = new DebugBuilder("server", "discordBot.command.update");
|
||||
import { SlashCommandBuilder } from 'discord.js';
|
||||
import { requestNodeUpdate } from '../../modules/socketServerWrappers.mjs';
|
||||
import { SlashCommandBuilder } from "discord.js";
|
||||
import { requestNodeUpdate } from "../../modules/socketServerWrappers.mjs";
|
||||
|
||||
// Exporting data property that contains the command structure for discord including any params
|
||||
export const data = new SlashCommandBuilder()
|
||||
.setName('update')
|
||||
.setDescription('Updates all nodes currently logged on');
|
||||
.setName("update")
|
||||
.setDescription("Updates all nodes currently logged on");
|
||||
|
||||
// Exporting other properties
|
||||
export const example = "/update"; // An example of how the command would be run in discord chat, this will be used for the help command
|
||||
@@ -19,19 +19,21 @@ export const deferInitialReply = false; // If we the initial reply in discord sh
|
||||
*/
|
||||
export const execute = async (nodeIo, interaction) => {
|
||||
try {
|
||||
const openSockets = [...await nodeIo.allSockets()]; // TODO - Filter the returned nodes to only nodes that have the radio capability
|
||||
const openSockets = [...(await nodeIo.allSockets())]; // TODO - Filter the returned nodes to only nodes that have the radio capability
|
||||
log.DEBUG("All open sockets: ", openSockets);
|
||||
|
||||
// Check each open socket to see if the node has the requested system
|
||||
await Promise.all(openSockets.map(openSocket => {
|
||||
openSocket = nodeIo.sockets.sockets.get(openSocket);
|
||||
requestNodeUpdate(openSocket);
|
||||
}));
|
||||
await Promise.all(
|
||||
openSockets.map((openSocket) => {
|
||||
openSocket = nodeIo.sockets.sockets.get(openSocket);
|
||||
requestNodeUpdate(openSocket);
|
||||
}),
|
||||
);
|
||||
//await interaction.reply(`**Online Sockets: '${sockets}'**`);
|
||||
await interaction.reply('All nodes have been requested to update');
|
||||
await interaction.reply("All nodes have been requested to update");
|
||||
//await interaction.channel.send('**Pong.**');
|
||||
} catch (err) {
|
||||
console.error(err);
|
||||
// await interaction.reply(err.toString());
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user