test
This commit is contained in:
parent
bb1c0b717d
commit
8a5bb59b6d
@ -305,21 +305,26 @@ const getMinecraftStatus = async () => {
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
const buildPanelEmbed = (status) => {
|
const buildPanelEmbed = (status, thumbnailUrl = null) => {
|
||||||
const stateText = status.online ? "🟢 En ligne" : "🔴 Hors ligne";
|
const stateText = status.online ? "🟢 En ligne" : "🔴 Hors ligne";
|
||||||
const playersText = `${status.playersOnline}/${status.playersMax}`;
|
const playersText = `${status.playersOnline}/${status.playersMax}`;
|
||||||
const playersListText = status.playerList.length > 0 ? status.playerList.map(element => element.name).join(", ") : "Aucun joueur connecte";
|
const playersListText = status.playerList.length > 0 ? status.playerList.map(element => element.name).join(", ") : "Aucun joueur connecte";
|
||||||
const message = new EmbedBuilder()
|
const message = new EmbedBuilder()
|
||||||
.setColor('#0099ff')
|
.setColor('#0099ff')
|
||||||
.setDescription('# Informations sur le Serveur \n\n## :wireless: IP :\n### goofymon.louismazin.ovh\n\n## :repeat: État :\n### '+stateText+'\n\n## :busts_in_silhouette: Joueurs :\n### '+playersText+'\n\n## :video_game: Version :\n### '+status.version+'\n\n## :bust_in_silhouette: Liste des joueurs :\n### '+playersListText);
|
.setDescription('# Informations sur le Serveur \n\n## :wireless: IP :\n### goofymon.louismazin.ovh\n\n## :repeat: État :\n### '+stateText+'\n\n## :busts_in_silhouette: Joueurs :\n### '+playersText+'\n\n## :video_game: Version :\n### '+status.version+'\n\n## :bust_in_silhouette: Liste des joueurs :\n### '+playersListText);
|
||||||
|
|
||||||
|
if (thumbnailUrl) {
|
||||||
|
message.setThumbnail(thumbnailUrl);
|
||||||
|
}
|
||||||
|
|
||||||
return message;
|
return message;
|
||||||
};
|
};
|
||||||
|
|
||||||
const buildPanelPayload = (status, messageId, pinboardItems = null, options = {}) => {
|
const buildPanelPayload = (status, messageId, pinboardItems = null, options = {}) => {
|
||||||
const panelEmbed = buildPanelEmbed(status);
|
|
||||||
const items = (pinboardItems || parsePinboardImageItems()).slice(0, 25);
|
const items = (pinboardItems || parsePinboardImageItems()).slice(0, 25);
|
||||||
|
|
||||||
if (items.length === 0) {
|
if (items.length === 0) {
|
||||||
|
const panelEmbed = buildPanelEmbed(status);
|
||||||
return { content: '', embeds: [panelEmbed], components: [] };
|
return { content: '', embeds: [panelEmbed], components: [] };
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -333,6 +338,8 @@ const buildPanelPayload = (status, messageId, pinboardItems = null, options = {}
|
|||||||
disableCacheBust: options.disableCacheBustForSelected,
|
disableCacheBust: options.disableCacheBustForSelected,
|
||||||
refreshKey: options.refreshKey
|
refreshKey: options.refreshKey
|
||||||
});
|
});
|
||||||
|
const selectedImageUrl = selectedImageEmbed.data?.image?.url || null;
|
||||||
|
const panelEmbed = buildPanelEmbed(status, selectedImageUrl);
|
||||||
const selectorRow = buildImageSelectorRow(items, currentIndex);
|
const selectorRow = buildImageSelectorRow(items, currentIndex);
|
||||||
const navigationRow = buildImageNavigationRow(items, currentIndex);
|
const navigationRow = buildImageNavigationRow(items, currentIndex);
|
||||||
|
|
||||||
@ -343,7 +350,7 @@ const buildPanelPayload = (status, messageId, pinboardItems = null, options = {}
|
|||||||
|
|
||||||
return {
|
return {
|
||||||
content: '',
|
content: '',
|
||||||
embeds: [panelEmbed, selectedImageEmbed],
|
embeds: [panelEmbed],
|
||||||
components: [selectorRow, navigationRow],
|
components: [selectorRow, navigationRow],
|
||||||
files
|
files
|
||||||
};
|
};
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user