Code not run in discord.js v12

client.on(‘error’, () => console.error);

client.on(‘warn’, () => console.warn);

client.on(‘ready’, function() {
setInterval(async () => {
const statuslist = [
$help | Serving ${client.guilds.size} servers,
$help | Serving ${client.channels.size} channels,
$help | Serving ${client.users.size} users
];
const random = Math.floor(Math.random() * statuslist.length);

try {
  await client.user.setPresence({
    game: {
      name: `${statuslist[random]}`,
      type: "Streaming"
      //url: 'https://www.twitch.tv/spokloo'
    },
    status: "DND"
  });
} catch (error) {
  console.error(error);
}

}, 10000);
});

There were a lot of changes in djs v12. I recommend going to https://discordjs.guide to see them all.

await is for discord.py

@impressiveaustin

await is also a JS Operator.

4 Likes