Discord.js bot update activity

I wanted to create an updating status with all kind of activity on my BOT. This is the code of what I have done so far:

const activities = [
        {
            type : "PLAYING",
            activity : "with the ball"
        },
        {
            type : "WATCHING",
            activity : "your soul"
        }
    ];

    for (var i = 0; i < activities.length; i++) {
        setInterval(() => client.user.setActivity(`${activities[i].activity}`, { type: `${activities[i].type}` }));
    };

When I try to start the BOT, the terminal shows

TypeError: Cannot read property ‘activity’ of undefined

Probably the code is totally wrong, but I’m not very good at javascript. Any suggestions?

19 thoughts on “Discord.js bot update activity”

Leave a Comment