forked from ChrisChrome/weather-bot
Add new command to list available rooms in index.js
This commit is contained in:
parent
b746a19476
commit
0c7ad1d515
20
index.js
20
index.js
|
@ -322,6 +322,10 @@ discord.on('ready', async () => {
|
||||||
{
|
{
|
||||||
"name": "about",
|
"name": "about",
|
||||||
"description": "About this bot"
|
"description": "About this bot"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "rooms",
|
||||||
|
"description": "List all available rooms"
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
|
||||||
|
@ -450,6 +454,22 @@ discord.on("interactionCreate", async (interaction) => {
|
||||||
}
|
}
|
||||||
interaction.reply({ embeds: [embed] });
|
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;
|
break;
|
||||||
case Discord.InteractionType.MessageComponent:
|
case Discord.InteractionType.MessageComponent:
|
||||||
|
|
Loading…
Reference in a new issue