anketa now supports upto 25 options
This commit is contained in:
parent
ef8bcbcd4b
commit
e8661ac39b
4
package-lock.json
generated
4
package-lock.json
generated
@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "denim_3001",
|
||||
"version": "3001.46.0",
|
||||
"version": "3001.47.0",
|
||||
"lockfileVersion": 2,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "denim_3001",
|
||||
"version": "3001.46.0",
|
||||
"version": "3001.47.0",
|
||||
"license": "ISC",
|
||||
"dependencies": {
|
||||
"@discordjs/voice": "^0.14.0",
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "denim_3001",
|
||||
"version": "3001.46.0",
|
||||
"version": "3001.47.0",
|
||||
"description": "Toto je velmi kvalitní bot.",
|
||||
"repository": {
|
||||
"url": "https://github.com/Histmy/Denim-Bot/"
|
||||
|
||||
@ -36,6 +36,7 @@ const exp: Modul = {
|
||||
return acc;
|
||||
}, []);
|
||||
if (moznosti.length < 2) return "zadej alespo%n dve moznosti";
|
||||
if (moznosti.length > 25) return "toje moc";
|
||||
|
||||
const konec = new Date();
|
||||
konec.setSeconds(konec.getSeconds() + settings.time);
|
||||
@ -45,7 +46,7 @@ const exp: Modul = {
|
||||
description: settings.immediateShow ? `Končí ${formatter(konec)}` : `Výsledky se zobrazí ${formatter(konec)}`
|
||||
};
|
||||
const x5fxd55: APIEmbedField[] = [];
|
||||
const radek = new ActionRowBuilder<ButtonBuilder>();
|
||||
const radky: ActionRowBuilder<ButtonBuilder>[] = [];
|
||||
const odpovedi: Record<string, number> = {};
|
||||
|
||||
function prepocitat(): void;
|
||||
@ -67,12 +68,14 @@ const exp: Modul = {
|
||||
}
|
||||
|
||||
moznosti.forEach((h, i) => {
|
||||
const mnam = (i - (i % 5)) / 5;
|
||||
if (i % 5 == 0) radky[mnam] = new ActionRowBuilder<ButtonBuilder>;
|
||||
x5fxd55.push({ name: h, value: "" });
|
||||
radek.addComponents(new ButtonBuilder({ customId: `${i}`, label: h, style: ButtonStyle.Primary }));
|
||||
radky[mnam].addComponents(new ButtonBuilder({ customId: `${i}`, label: h, style: ButtonStyle.Primary }));
|
||||
});
|
||||
prepocitat();
|
||||
if (settings.immediateShow) embed.fields = x5fxd55;
|
||||
const zprava = await mes.channel.send({ embeds: [embed], components: [radek] });
|
||||
const zprava = await mes.channel.send({ embeds: [embed], components: radky });
|
||||
const collector = mes.channel.createMessageComponentCollector<ComponentType.Button>({ filter: i => i.message.id == zprava.id, time: settings.time * 1000 });
|
||||
|
||||
collector.on("collect", d => {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user