help

i want to update this code : client.user.setPresence({ activities: [{ name: p!help | ${client.guilds.cache.size} Servers, type: ActivityType.Playing }], status: 'online', });
to update the bots presence every 30s
21 Replies
d.js toolkit
d.js toolkit14mo ago
- 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!
chewie
chewie14mo ago
then put it in an setInterval
d.js docs
d.js docs14mo ago
mdn 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.
PΣЯ✘
PΣЯ✘OP14mo ago
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.1
chewie
chewie14mo ago
I literally just told you what you have to do and even gave you a link to a guide page
PΣЯ✘
PΣЯ✘OP14mo ago
ok i dont understand it can u help me update it?
chewie
chewie14mo ago
No, I gave you everything you need. Now you just lack fundamental knowledge of javascript. #rules 3 #resources
PΣЯ✘
PΣЯ✘OP14mo ago
@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);}
chewie
chewie14mo ago
try it
PΣЯ✘
PΣЯ✘OP14mo ago
kk wait where do i set the secs @thehairy
chewie
chewie14mo ago
the guide tells you and please stop pinging me no spoonfeeding here
Aurora
Aurora14mo ago
fair ugly do get a point though, some people do need to learn basic idk
chewie
chewie14mo ago
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.
Aurora
Aurora14mo ago
good point, but if you really think about it, isnt there like a ton of documentations about javascript and how to use it
chewie
chewie14mo ago
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
Aurora
Aurora14mo ago
OkCute anyway, i have some work to finish, have a great rest of your day or bye
chewie
chewie14mo ago
reallyFckingPoof
PΣЯ✘
PΣЯ✘OP14mo ago
its not that ik js but im new to discordjs
chewie
chewie14mo ago
this has absolutely nothing to do with djs this is basic javascript
PΣЯ✘
PΣЯ✘OP14mo ago
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)
chewie
chewie14mo ago
that highly depends on the djs version you are using mmLol
Want results from more Discord servers?
Add your server