3eif / ear-tensifier

Powerful Discord entertainment bot in over 500,000 servers.
https://eara.io
GNU General Public License v3.0
232 stars 76 forks source link

DeprecationWarning: Passing strings for MessageEmbed#setFooter is deprecated. Pass a sole object instead. #252

Closed ItachizX closed 1 year ago

ItachizX commented 1 year ago

const Discord = require("discord.js") const db = require("quick.db") const config = require("../config.json") module.exports = {

name: "stock", // Coloque o nome do comando do arquivo
run: async(client, message, args) => {
    message.delete()
    const embederro = new Discord.MessageEmbed()
    .setTitle(`Erro - Permissão`)
    .setDescription(`Você não tem permissão para isto!`)
    .setColor(config.cor)
    .setFooter(`${config.nomebot} - Todos os direitos reservados.`)
    if (!message.member.permissions.has("ADMINISTRATOR")) return message.channel.send({ embeds: [embederro] }).then(msg => {
                setTimeout(() => msg.delete(), 5000)
            })
            const embednprod = new Discord.MessageEmbed()
            .setTitle("Erro - Sistema de Estoque")
            .setDescription("Você não tem nenhum produto adicionado, utilize \`[add]\` para criar o produto!")
            .setColor(config.cor)
    if(db.all().length == 0) return message.channel.send({embeds: [embednprod]}).then(msg => {
        setTimeout(() => msg.delete(), 10000)
    })

const itens = db.all().map(item => ID: ${item.ID} | QUANTIDADE: ${item.data.conta.length || "0"}) const embed = new Discord.MessageEmbed() .setTitle("Estoque") .setDescription(\``${itens.join("\n\n")}````) .setColor(config.cor) message.channel.send({embeds: [embed]}).then(msg => { setTimeout(() => msg.delete(), 10000) })

}

}

[4:23 PM] 🚫 ・ Erro Detectado: [4:23 PM] TypeError: Cannot read properties of undefined (reading 'length') unhandledRejection [4:23 PM] 🚫 ・ Erro Detectado: [4:23 PM] TypeError: Cannot read properties of undefined (reading 'length') unhandledRejection

bimoware commented 1 year ago

Maybe if you tried the strict minimum (copy pasting the error in google) you'd know: https://stackoverflow.com/questions/70602287/passing-strings-for-messageembedsetfooter-is-deprecated

3eif commented 1 year ago

Maybe if you tried the strict minimum (copy pasting the error in google) you'd know: https://stackoverflow.com/questions/70602287/passing-strings-for-messageembedsetfooter-is-deprecated

Thanks, just realized this code is not even part of Ear Tensifier's repo