How do I make the bot wait for a response then send a Message Embed to the channel mentioned?

Viewed 66

Here is my current code:

const user = message.author.username;
            const announcementschannel = message.mentions.channels.first();
            if (!announcementschannel) {
                message.channel.send('⚠ You must specify an **Announcements** channel! ⚠');
            } else {
                let filter = m => m.author.id === message.author.id
                message.channel.send(`Please enter your message 'usage:<Title>, <line1>, <line2>'`);
                message.channel.awaitMessages(filter, {
                    max: 1,
                    time: 30000,
                    errors: ['time']
                })
                    .then(message => {
                        const embed = new discord.MessageEmbed();
                        embed.setDescription(args.join(' ').split(','));
                        embed.setColor('RANDOM');
                        // message.channel.send(embed);
                        announcementschannel.send(embed);
                    })
                    .catch(collected => {
                        message.channel.send('Timeout');
                    })
            }

When the code is first ran, command syntax "+announce #ChannelMention" Then it successfully asks you to input the rest of the details. After sending the details, the bot doesnt respond.

0 Answers
Related