Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- else if (commandName === 'vote') {
- var Accepted = [];
- var Declined = [];
- const embed = {
- title: 'vote',
- description: `${interaction.options.getString('treść')}`,
- fields: [
- {
- name: 'Osoby, które są za:',
- value: `Czekanie na odpowiedź... `,
- },
- {
- name: 'Osoby, które są przeciw:',
- value: `Czekanie na odpowiedź... `,
- },
- ],
- }
- const row = new MessageActionRow()
- .addComponents(
- new MessageButton()
- .setCustomId('za')
- .setLabel('Jestem za')
- .setStyle('SUCCESS'),
- new MessageButton()
- .setCustomId('przeciw')
- .setLabel('Jestem przeciw')
- .setStyle('DANGER'),
- );
- await interaction.reply({ embeds: [embed], components: [row] });
- const collector = interaction.channel.createMessageComponentCollector({ componentType: 'BUTTON', time: 86400000 });
- collector.on('collect', i => {
- if (i.customId === 'za') {
- i.reply({ content: 'Twoja odpowiedź: **Jestem za**', ephemeral: true })
- Accepted.push(`${i.user.username}`)
- console.log(Accepted)
- const embed = {
- title: 'vote',
- description: `${interaction.options.getString('treść')}`,
- fields: [
- {
- name: 'Osoby, które są za:',
- value: `${Accepted}`,
- },
- {
- name: 'Osoby, które są przeciw:',
- value: `${Declined}`,
- },
- ],
- }
- interaction.editReply({ embeds: [embed] });
- }
- else if (i.customId === 'przeciw') {
- i.reply({ content: 'Twoja odpowiedź: **Jestem przeciw**', ephemeral: true })
- Declined.push(`${i.user.username}`)
- const embed = {
- title: 'vote',
- description: `${interaction.options.getString('treść')}`,
- fields: [
- {
- name: 'Osoby, które są za:',
- value: `${Accepted}`,
- },
- {
- name: 'Osoby, które są przeciw:',
- value: `${Declined}`,
- },
- ],
- }
- interaction.editReply({ embeds: [embed] });
- }
- });
- collector.on('end', collected => {
- console.log(`Collected ${collected.size} interactions.`);
- });
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement