24 lines
1002 B
JavaScript
24 lines
1002 B
JavaScript
const { SlashCommandBuilder } = require('discord.js');
|
|
const api = require('../api');
|
|
|
|
module.exports = {
|
|
name: 'list-twitchusers',
|
|
description: 'List watched Twitch usernames for this server (Live Notifications).',
|
|
enabled: true,
|
|
builder: new SlashCommandBuilder().setName('list-twitchusers').setDescription('List watched Twitch usernames for this server'),
|
|
async execute(interaction) {
|
|
try {
|
|
const users = await api.getTwitchUsers(interaction.guildId) || [];
|
|
if (!users || users.length === 0) {
|
|
await interaction.reply({ content: 'No Twitch users are being watched for this server.', ephemeral: true });
|
|
return;
|
|
}
|
|
const list = users.map(u => `• ${u}`).join('\n');
|
|
await interaction.reply({ content: `Watched Twitch users:\n${list}`, ephemeral: true });
|
|
} catch (e) {
|
|
console.error('Error listing twitch users:', e);
|
|
await interaction.reply({ content: 'Failed to retrieve watched users.', ephemeral: true });
|
|
}
|
|
},
|
|
};
|