A
A
Artem Melnykov2020-02-28 20:46:35
Node.js
Artem Melnykov, 2020-02-28 20:46:35

Why is the data not updating?

There is a taco code:

bot.on('ready', () => {
bot.setInterval(() => {
  let myGuild = bot.guilds.get("655370251336286248")!
  let memberCount = myGuild.memberCount;
  let memberCountChannel = myGuild.channels.get("682994683948826684");
  memberCountChannel.setName("Участников: " + memberCount);
}, 1000);
});

And in fact it should update the data every second, but it only updates them after a restart, I tried to take out bot.setInterval .. for bot.on, but it gives an error that myGuild.memberCount cannot be read. what to do?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Shohruh Shaimardonov, 2020-02-28
@joeberetta

Replace
bot.setInterval
With
setInterval

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question