WIP basic card dropping

This commit is contained in:
2022-08-18 19:24:44 +02:00
parent 29e3e6de23
commit ae60732836
13 changed files with 265 additions and 58 deletions

27
util/reply.js Normal file
View File

@@ -0,0 +1,27 @@
const { ActionRowBuilder, ButtonBuilder, ButtonStyle, ComponentType } = require("discord.js");
module.exports = {
name: "ReplyUtils",
recreateComponents: function(components) {
console.log("Recreating components");
for (let i = 0; i < components.length; i++) {
let row = new ActionRowBuilder();
for (let j = 0; j < components[i].components.length; j++) {
console.log(components[i].components[j]);
console.log(`Recreating button ${components[i].components[j].customId}`);
let button = new ButtonBuilder();
button.setCustomId(components[i].components[j].customId);
button.setLabel(components[i].components[j].label);
button.setStyle(components[i].components[j].style);
if (components[i].components[j].emoji) {
button.setEmoji(components[i].components[j].emoji);
}
if (components[i].components[j].disabled) {
button.setDisabled(components[i].components[j].disabled);
}
row.addComponents(button);
}
return row;
}
},
}