#sad

1 messages · Page 1 of 1 (latest)

barren herald
#

asd

#

where then

#

the cooldown annoys me

hot wharf
#

After setTimeout

barren herald
#

what do I put in setTimeout hten?

#

then*

hot wharf
#

const index = cd.indexOf(i.user.id);
cd.splice(index, 1)

barren herald
#

aight

#

I feel like im wrong but :

 if(interaction.isButton()){
        if(interaction.customId === 'ticketCreate'){
            const cd = [];
            if(cd.includes(i.user.id)) {
                return
            } else {
                cd.push(i.user.id);
                setTimeout(function(){
                    const index = cd.indexOf(i.user.id);
                    cd.splice(index, 1);
                  
                    }
                )}
            await interaction.deferUpdate()

            interaction.guild.channels.create(`ticket-${interaction.user.username}`, {
                type: "GUILD_TEXT",
                parent: "961673841334186035",
                topic: `${interaction.user.tag}'s ticket`,
                permissionOverwrites: [
                    {
                    id: interaction.user.id,
                    allow: ["VIEW_CHANNEL", "SEND_MESSAGES"]
                    },
                    {
                    id: support.id,
                    allow: ["VIEW_CHANNEL", "SEND_MESSAGES"]
                    },
                    {
                    id: everyone.id,
                    deny: ["VIEW_CHANNEL", "SEND_MESSAGES"]
                    }
                ]
            }).then(c => {
                const ticketEmbed = new MessageEmbed()
                .setTitle('New ticket')
                .setDescription(`Thank you for opening the ticket. \n
                 You can ask help for whatever you want (related to the server / housing relate wid ofcourse)\n
                 Our staff will answer everything soon!`)
                .setTimestamp()
                .setFooter('Mawios\'s Stuff')
                .setColor('RANDOM')

     


                c.send({ content: `${support}`, embeds: [ticketEmbed], components: [deleteButton] })
            })
        }}
    }
)
hot wharf
#

It looks fine to me but you put the rest of your code outside of the second if statement idk if its intentional

barren herald
#

would it affect my code?

hot wharf
#

Yes

barren herald
#

umm what do i do then

hot wharf
#

Put it inside the second if statement block

barren herald
#

I feel like I did it wrong

#

becaus emy english sucsk as frick and i dont understand every 2nd word lol

hot wharf
#

You just need to put the code inside the second if statement {} curly brackets