help
i want to update this code : client.user.setPresence({
activities: [{ name:
to update the bots presence every 30s
p!help | ${client.guilds.cache.size} Servers
, type: ActivityType.Playing }],
status: 'online',
});to update the bots presence every 30s
21 Replies
- What's your exact discord.js
npm list discord.js
and node node -v
version?
- Not a discord.js issue? Check out #other-js-ts.
- Consider reading #how-to-get-help to improve your question!
- Explain what exactly your issue is.
- Post the full error stack trace, not just the top part!
- Show your code!
- Issue solved? Press the button!then put it in an setInterval
setInterval() global function
The setInterval() method, offered on the Window and Worker interfaces, repeatedly calls a function or executes a code snippet, with a fixed time delay between each call.
the
version is
18.17.1
@thehairy
node
can u update it from me?
client.user.setPresence({
activities: [{ name:
p!help | ${client.guilds.cache.size} Servers
, type: ActivityType.Playing }],
status: 'online',
});
node.js 18.17.1I literally just told you what you have to do
and even gave you a link to a guide page
ok
i dont understand it
can u help me update it?
No, I gave you everything you need.
Now you just lack fundamental knowledge of javascript.
#rules 3 #resources
@thehairy is this correct?
const intervalID = setInterval(myCallback, 500, "Parameter 1", "Parameter 2");function myCallback(a, b) {client.user.setPresence({ activities: [{ name:
p!help | ${client.guilds.cache.size} Servers
, type: ActivityType.Playing }], status: 'online',}); console.log(a); console.log(b);}try it
kk
wait
where do i set the secs
@thehairy
the guide tells you
and please stop pinging me
no spoonfeeding here
fair do get a point though, some people do need to learn basic
without the proper knowledge, they won't know what to do with the code you provide, and just providing code without any explanations whatsoever doesn't help either, as it results in the same problem.
good point, but if you really think about it, isnt there like a ton of documentations about javascript and how to use it
thats why I linked the mdn guide instead of spoonfeeding as it contains detailed instructions on how to use setInterval and also explains it very well, and we have #resources
anyway, i have some work to finish, have a great rest of your day or
its not that
ik js but im new to discordjs
this has absolutely nothing to do with djs
this is basic javascript
why wont this not work?
client.user.setPresence({
activities: [{ name:
p!help | ${client.guilds.cache.size} Servers
, type: 'PLAYING' }],
status: 'online',
});
// Update the presence every 30 seconds
setInterval(() => {
client.user.setPresence({
activities: [{ name: p!help | ${client.guilds.cache.size} Servers
, type: 'PLAYING' }],
status: 'online',
});
}, 30000); // 30,000 milliseconds (30 seconds)that highly depends on the djs version you are using