Saitama
Saitama
Explore posts from servers
SIASapphire - Imagine a framework
Created by Saitama on 12/27/2023 in #sapphire-support
LoaderStrategy: promises.opendir is being broken if using with @vercel/pkg library
Thought of it But thought there'd be another way
8 replies
SIASapphire - Imagine a framework
Created by Saitama on 12/27/2023 in #sapphire-support
LoaderStrategy: promises.opendir is being broken if using with @vercel/pkg library
well yea it's a solution
8 replies
SIASapphire - Imagine a framework
Created by Saitama on 12/14/2023 in #sapphire-support
PaginatedMessage: How to disable footer?
Sure
20 replies
SIASapphire - Imagine a framework
Created by Saitama on 12/14/2023 in #sapphire-support
PaginatedMessage: There are no actions
It works! Thank you!
14 replies
SIASapphire - Imagine a framework
Created by Saitama on 12/14/2023 in #sapphire-support
PaginatedMessage: There are no actions
yea, I am)
14 replies
SIASapphire - Imagine a framework
Created by Saitama on 12/14/2023 in #sapphire-support
PaginatedMessage: How to disable footer?
ASyes
20 replies
SIASapphire - Imagine a framework
Created by Saitama on 12/14/2023 in #sapphire-support
PaginatedMessage: How to disable footer?
sigh
20 replies
SIASapphire - Imagine a framework
Created by Saitama on 12/14/2023 in #sapphire-support
PaginatedMessage: How to disable footer?
20 replies
SIASapphire - Imagine a framework
Created by Saitama on 12/14/2023 in #sapphire-support
PaginatedMessage: How to disable footer?
Could you check out this one too? @Favna
20 replies
SIASapphire - Imagine a framework
Created by Saitama on 12/14/2023 in #sapphire-support
PaginatedMessage: There are no actions
yea just checked the #GitHub Logs Thankyou
14 replies
SIASapphire - Imagine a framework
Created by Saitama on 12/14/2023 in #sapphire-support
PaginatedMessage: There are no actions
kinda lame tho that I don't have full control over action row cus it's managed via library (don't wanna go there and extended, override method) But it is what it is
14 replies
SIASapphire - Imagine a framework
Created by Saitama on 12/14/2023 in #sapphire-support
PaginatedMessage: There are no actions
no worries at first I got confused too Here's code
private async sendMenu(interactionOrMessage: Message | AnyInteractableInteraction) {
const radioStations = radioList; // await Radio.findAll();
const chunkSize = 10;
const paginatedMessage = new PaginatedMessageEmbedFields()
.setActions([])
.setTemplate({
title: 'Radio Stations',
color: parseInt(getRandomHexColor().replace('#', ''), 16)
})
.setItems(
radioStations.map((radioStation) => ({
name: `${getEmojiBasedOnString(radioStation.name)} ${radioStation.name}`,
value: radioStation.url,
inline: false
}))
)
.setItemsPerPage(chunkSize)
.make()
.addActions([
{
style: ButtonStyle.Primary,
label: '◀',
customId: 'back-page',
type: ComponentType.Button,
run: async () => {
if (paginatedMessage.hasPage(paginatedMessage.index - 1)) {
paginatedMessage.setIndex(paginatedMessage.index - 1);
}
}
},
{
style: ButtonStyle.Primary,
label: '▶',
customId: 'next-page',
type: ComponentType.Button,
run: async () => {
if (paginatedMessage.hasPage(paginatedMessage.index + 1)) {
paginatedMessage.setIndex(paginatedMessage.index + 1);
}
}
}
])

for (let i = 0; i < radioStations.length; i += chunkSize) {
paginatedMessage.setPageActions(
[
{
style: ButtonStyle.Secondary,
label: `${Math.round((i + chunkSize) / chunkSize)}/${Math.round(radioStations.length / chunkSize)}`,
customId: 'cur-page',
type: ComponentType.Button,
disabled: true
},
{
customId: 'select-radio',
placeholder: 'Выбрать Радио',
type: ComponentType.StringSelect,
options: radioStations.slice(i, i + chunkSize).map(radioStation => ({
label: radioStation.name,
value: radioStation.name,
emoji: getEmojiBasedOnString(radioStation.name)
}))
}
],
1
);
}

paginatedMessage.addActions([
{
customId: 'add-radio',
emoji: '➕',
label: 'Добавить Радио',
style: ButtonStyle.Primary,
type: ComponentType.Button,
disabled: true
}
]);

paginatedMessage.run(interactionOrMessage);
}
private async sendMenu(interactionOrMessage: Message | AnyInteractableInteraction) {
const radioStations = radioList; // await Radio.findAll();
const chunkSize = 10;
const paginatedMessage = new PaginatedMessageEmbedFields()
.setActions([])
.setTemplate({
title: 'Radio Stations',
color: parseInt(getRandomHexColor().replace('#', ''), 16)
})
.setItems(
radioStations.map((radioStation) => ({
name: `${getEmojiBasedOnString(radioStation.name)} ${radioStation.name}`,
value: radioStation.url,
inline: false
}))
)
.setItemsPerPage(chunkSize)
.make()
.addActions([
{
style: ButtonStyle.Primary,
label: '◀',
customId: 'back-page',
type: ComponentType.Button,
run: async () => {
if (paginatedMessage.hasPage(paginatedMessage.index - 1)) {
paginatedMessage.setIndex(paginatedMessage.index - 1);
}
}
},
{
style: ButtonStyle.Primary,
label: '▶',
customId: 'next-page',
type: ComponentType.Button,
run: async () => {
if (paginatedMessage.hasPage(paginatedMessage.index + 1)) {
paginatedMessage.setIndex(paginatedMessage.index + 1);
}
}
}
])

for (let i = 0; i < radioStations.length; i += chunkSize) {
paginatedMessage.setPageActions(
[
{
style: ButtonStyle.Secondary,
label: `${Math.round((i + chunkSize) / chunkSize)}/${Math.round(radioStations.length / chunkSize)}`,
customId: 'cur-page',
type: ComponentType.Button,
disabled: true
},
{
customId: 'select-radio',
placeholder: 'Выбрать Радио',
type: ComponentType.StringSelect,
options: radioStations.slice(i, i + chunkSize).map(radioStation => ({
label: radioStation.name,
value: radioStation.name,
emoji: getEmojiBasedOnString(radioStation.name)
}))
}
],
1
);
}

paginatedMessage.addActions([
{
customId: 'add-radio',
emoji: '➕',
label: 'Добавить Радио',
style: ButtonStyle.Primary,
type: ComponentType.Button,
disabled: true
}
]);

paginatedMessage.run(interactionOrMessage);
}
14 replies
SIASapphire - Imagine a framework
Created by Saitama on 12/14/2023 in #sapphire-support
PaginatedMessage: There are no actions
No description
14 replies