Add new command to list available rooms in index.js

This commit is contained in:
Christopher Cookman 2024-05-08 08:12:55 -06:00
parent b746a19476
commit 0c7ad1d515
Signed by: ChrisChrome
GPG key ID: A023A26E42C33A42

View file

@ -322,6 +322,10 @@ discord.on('ready', async () => {
{
"name": "about",
"description": "About this bot"
},
{
"name": "rooms",
"description": "List all available rooms"
}
];
@ -450,6 +454,22 @@ discord.on("interactionCreate", async (interaction) => {
}
interaction.reply({ embeds: [embed] });
});
break;
case "rooms":
// Send an embed showing all the available rooms
let roomList = "";
config.iem.channels.forEach((channel) => {
roomList += `\`${channel.jid.split("@")[0]}\`: ${channel.name}\n`;
});
const roomEmbed = {
title: "Available Rooms",
description: roomList,
color: 0x00ff00
}
interaction.reply({ embeds: [roomEmbed] });
break;
}
break;
case Discord.InteractionType.MessageComponent: