pipin
pipin

Reputation: 11

If lines in txt file is 0 it should embed emoji

I'm making an account gen bot with discord.js. In this case, I need to add an emoji to embed if a text file has less than 0 (❌) this emoji. If the minecraft.txt has more than 1, I should send (✅) in the embed.

Here is the stock cmd code:

const Discord = require('discord.js')

 module.exports.run = async (bot, message, args, gen) => {
 let embed = new Discord.MessageEmbed()
  .setTitle('**Accounts In Stock**')
  .setColor(`#33FFFF`)
  gen.calculateStock()
  setTimeout(() => {
     const stock = gen.stock
    for(const type of stock) {
        embed.addField(type[0], type[1], true)
    }
    message.channel.send(embed)
    setTimeout(() => message.delete(), 10000);
 }, 200);
 
 }
 module.exports.help = {
 name: 'stock',
 aliases: []
 }

Output

Upvotes: 0

Views: 78

Answers (1)

Ape
Ape

Reputation: 57

Use Message.React() So just add

message.channel.send(embed).then(message => for(const type of stock) {
    if (type[1]<=0) {message.react('❌')} else {message.react('✅')}
}

Upvotes: 0

Related Questions