I
I
Ivan2021-01-06 18:04:53
Node.js
Ivan, 2021-01-06 18:04:53

Why does it say that you cannot send an empty message?

if(users[userid].isAdmin && message.replace(/@/g, "").replace(/\/профиль/g) && !message.startsWith(" ")) {
        let user = client.users.find(user => user.username == "TESTname").id;
        if(user.id != "undefined") {
            var text = users[userid].name + ", профиль игрока " + users[user.id].name + "\n:dollar: Баланс " + users[user.id].money + "$\n:credit_card: В банке " + user.bank + "$\n:notebook_with_decorative_cover: Дата регистрации " + users[user.id].date;
            return text;
        } else {
            var text = "«" + user.id + "»\n" + "«" + message.replace(/@/g, "").replace(/профиль/g) + "»";
            return text;
        }
    }

Mistake
UnhandledPromiseRejectionWarning: DiscordAPIError: Cannot send an empty message

Answer the question

In order to leave comments, you need to log in

1 answer(s)
K
Kirill, 2021-02-15
@KIRIK12

if(user.id != "undefined") {//код}
change to
if(user.id) {//код}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question