33 lines
1.2 KiB
JavaScript
33 lines
1.2 KiB
JavaScript
const { EmbedBuilder, ButtonBuilder, ActionRowBuilder } = require('discord.js');
|
|
|
|
function userStreamingEmbed(user, status) {
|
|
|
|
const username = user?.username || 'Unknown User';
|
|
const avatarURL = user?.displayAvatarURL({ dynamic: true }) || null;
|
|
const streamTitle = status?.details || 'No title available';
|
|
const gameName = status?.name || 'No game available';
|
|
const streamURL = status?.url || 'No URL available';
|
|
|
|
|
|
const embed = new EmbedBuilder()
|
|
.setTitle('📡 Live Stream Alert!')
|
|
.setDescription(`**${username}** Just went Live on Twitch!`)
|
|
.addFields( { name: 'Stream Title', value: streamTitle, inline: false }, { name: 'Game / Category', value: gameName, inline: true } )
|
|
.setColor('Green')
|
|
.setTimestamp()
|
|
.setFooter({ text: 'User Streaming Status' })
|
|
.setThumbnail(avatarURL);
|
|
|
|
const streamButton = new ButtonBuilder()
|
|
.setLabel('🎥 Watch Stream')
|
|
.setURL(streamURL)
|
|
.setStyle(5);
|
|
|
|
const row = new ActionRowBuilder()
|
|
.addComponents(streamButton);
|
|
return { embeds: [embed], components: [row] };
|
|
}
|
|
|
|
module.exports = {
|
|
userStreamingEmbed
|
|
};
|