H
H
Hdudu Djid2021-09-29 16:40:41
JavaScript
Hdudu Djid, 2021-09-29 16:40:41

Why does this code not work correctly?

I'm writing a discord bot. My bot shows how many people, and then just does not write. Here is the code:

async function change() {
    let members = client.guilds.cache.get("891189300375457792").memberCount 
    client.channels.cache.get('891189300375457792').setName(`На сервере: ${members}`); 
}

var interval = setInterval(function () { change(); }, 20000  );

Why is that?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
MamaLuyba, 2021-09-30
@MamaLuyba

since you have async, we can assume that await is needed before both methods

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question