Shinaii
SIASapphire - Imagine a framework
•Created by Shinaii on 2/2/2024 in #sapphire-support
PaginatedMessageEmbedFields empty array
So im kinda confused with the docs and im always getting empty array's when im trying to setItems over an array. i logged already my output from the array and its just an double Object (as it should be afaik) when im accessing the content inside that Object i get my Output as i wanted it but for some reason the PaginatedMessageEmbed can't access it... am i missing something?
Thats some of my code:
Thats the error :
And thats when i log just one Object in the array and the full array:
Maybe im just missing something or misread the docs :dummy:
const botInfoEmbedFields = [
{ name: 'Bot Name', value: interaction.client.user.username },
{ name: 'Bot Tag', value: interaction.client.user.tag },
{ name: 'Bot ID', value: interaction.client.user.id },
{ name: 'Bot Version', value: botVersion },
{ name: 'Bot Uptime', value: this.getUptime() },
{ name: 'Server Uptime', value: this.getServerUptime() },
{ name: 'Platform', value: os.platform() },
{ name: 'CPU', value: os.cpus()[0].model },
{ name: 'Memory', value: `${(os.totalmem() - os.freemem()) / 1024 / 1024} MB / ${os.totalmem() / 1024 / 1024} MB` },
{ name: 'Hostname', value: os.hostname() }
];
const paginatedFields = new PaginatedMessageEmbedFields()
.setTemplate({ title: 'Bot and System Information', color: '#0099ff' })
.setItems(botInfoEmbedFields)
.setItemsPerPage(5);
const pages = paginatedFields.make();
await interaction.editReply({ embeds: [pages[0]] });
paginatedFields.run(interaction);
}
const botInfoEmbedFields = [
{ name: 'Bot Name', value: interaction.client.user.username },
{ name: 'Bot Tag', value: interaction.client.user.tag },
{ name: 'Bot ID', value: interaction.client.user.id },
{ name: 'Bot Version', value: botVersion },
{ name: 'Bot Uptime', value: this.getUptime() },
{ name: 'Server Uptime', value: this.getServerUptime() },
{ name: 'Platform', value: os.platform() },
{ name: 'CPU', value: os.cpus()[0].model },
{ name: 'Memory', value: `${(os.totalmem() - os.freemem()) / 1024 / 1024} MB / ${os.totalmem() / 1024 / 1024} MB` },
{ name: 'Hostname', value: os.hostname() }
];
const paginatedFields = new PaginatedMessageEmbedFields()
.setTemplate({ title: 'Bot and System Information', color: '#0099ff' })
.setItems(botInfoEmbedFields)
.setItemsPerPage(5);
const pages = paginatedFields.make();
await interaction.editReply({ embeds: [pages[0]] });
paginatedFields.run(interaction);
}
Error processing command: Error: The items array is empty.
at _PaginatedMessageEmbedFields.make (/node_modules/@sapphire/discord.js-utilities/dist/esm/index.mjs:2452:13)
at BotInfoCommand.chatInputRun (/src/commands/Utility/botinfo.js?d=1706863810259&name=botinfo&extension=.js:47:47)
at async /node_modules/@sapphire/framework/dist/esm/listeners/application-commands/chat-input/CoreChatInputCommandAccepted.mjs:17:23
at async Object.fromAsync (d/node_modules/@sapphire/result/dist/esm/index.mjs:617:22)
at async _CoreListener.run (/node_modules/@sapphire/framework/dist/esm/listeners/application-commands/chat-input/CoreChatInputCommandAccepted.mjs:14:20)
at async Object.fromAsync (/node_modules/@sapphire/result/dist/esm/index.mjs:617:22)
at async _CoreListener._run (/node_modules/@sapphire/framework/dist/esm/lib/structures/Listener.mjs:24:20)
Error processing command: Error: The items array is empty.
at _PaginatedMessageEmbedFields.make (/node_modules/@sapphire/discord.js-utilities/dist/esm/index.mjs:2452:13)
at BotInfoCommand.chatInputRun (/src/commands/Utility/botinfo.js?d=1706863810259&name=botinfo&extension=.js:47:47)
at async /node_modules/@sapphire/framework/dist/esm/listeners/application-commands/chat-input/CoreChatInputCommandAccepted.mjs:17:23
at async Object.fromAsync (d/node_modules/@sapphire/result/dist/esm/index.mjs:617:22)
at async _CoreListener.run (/node_modules/@sapphire/framework/dist/esm/listeners/application-commands/chat-input/CoreChatInputCommandAccepted.mjs:14:20)
at async Object.fromAsync (/node_modules/@sapphire/result/dist/esm/index.mjs:617:22)
at async _CoreListener._run (/node_modules/@sapphire/framework/dist/esm/lib/structures/Listener.mjs:24:20)
2024-02-02 09:50:16 - INFO - Bot Name: CSL Project
2024-02-02 09:50:16 - INFO - [
2024-02-02 09:50:16 - INFO - [Object], [Object],
2024-02-02 09:50:16 - INFO - [Object], [Object],
2024-02-02 09:50:16 - INFO - [Object], [Object],
2024-02-02 09:50:16 - INFO - [Object], [Object],
2024-02-02 09:50:16 - INFO - [Object], [Object]
2024-02-02 09:50:16 - INFO - ]
2024-02-02 09:50:16 - INFO - Bot Name: CSL Project
2024-02-02 09:50:16 - INFO - [
2024-02-02 09:50:16 - INFO - [Object], [Object],
2024-02-02 09:50:16 - INFO - [Object], [Object],
2024-02-02 09:50:16 - INFO - [Object], [Object],
2024-02-02 09:50:16 - INFO - [Object], [Object],
2024-02-02 09:50:16 - INFO - [Object], [Object]
2024-02-02 09:50:16 - INFO - ]
3 replies