stachu did the rolesList work

Co-authored-by: BoberITman <BoberITman@users.noreply.github.com>
This commit is contained in:
2021-10-03 14:03:21 +02:00
parent 3a61296ff6
commit 270fcfa814

View File

@@ -1,3 +1,5 @@
const { MessageActionRow, MessageButton } = require('discord.js');
module.exports = { module.exports = {
name: 'embed', name: 'embed',
execute(cl, msg, args) { execute(cl, msg, args) {
@@ -31,7 +33,31 @@ module.exports = {
case 'rolki': case 'rolki':
embed.title = 'Rolki'; embed.title = 'Rolki';
embed.description = '#rolki jest kanałem do przyznawania sobie ról.'; embed.description = '#rolki jest kanałem do przyznawania sobie ról.';
readyMsg = { embeds: [embed] /*components: [rows]*/ }; embed.footer.text = '#rolki';
// code responsible for making lists of buttons out of cl.cfg.rolesList
// & including them in the readyMsg
let i = 1,
l = 0;
let btnList = [];
while (
cl.cfg.rolesList.length / 5 +
(cl.cfg.rolesList.length % 5 != 0 ? 1 : 0) >=
i
) {
let btnRow = new MessageActionRow();
for (l; l <= 5 * i - 1 && cl.cfg.rolesList[l] != undefined; l++) {
btnRow.addComponents(
new MessageButton()
.setCustomId(cl.cfg.rolesList[l])
.setLabel(`rolka ${cl.cfg.rolesList[l]}`)
.setStyle('SECONDARY')
);
}
btnList.push(btnRow);
console.log(btnList);
i++;
}
readyMsg = { embeds: [embed], components: btnList };
break; break;
default: default:
embed.title = `zły parametr: ` + args[0]; embed.title = `zły parametr: ` + args[0];