#Trying to make a better version of krpg bot
32 messages · Page 1 of 1 (latest)
Read this: https://dontasktoask.com/
I need code that makes separate rata
Data
ik what your trying to say im not showing code or the problem
What im saying is I can't get it to be separate variables and need code to make separate user data
@robust mauve
If I need to show you what I currently have for my command /start
yes, you should describe the environment, explain what you've tried, explain why it didn't work, and show relevant code.
Alt be
bet
let userStartTimes = [1];
//...
if(command == ('${/}start') {
// only add element if it doesnt exist already
if(!userStartTimes.some(el => el.id == message.author.id)) {
userStartTimes.add({id: message.author.id, time: Date.now()});
}
}
if(command == "logout") {
let index = userStarTimes.findIndex(el => el.id == message.author.id);
// check if user has logged in before
if(index != -1) {
let msecSpent = Date.now() - userStartTimes[index].time;
// add to leaderboard
}
}
this is what I tried to use to make different user data for each person who creates a profile using /start
@robust mauve
?share
Wh
damn bot...
Wha
see #faq for help formatting code on Discord
- you've provided nowhere near enough information
- Discord supports code blocks. they make it far easier to parse/understand code. see #faq
note userStarTimes !== userStartTimes
What part of faq
😶
- you should always use
===and!==instead of==and!= userStarTimes !== userStartTimes- you still haven't explained exactly what you're trying to accomplish. if you want
userStartTimesto be an array/object matching user IDs, do it?
also just use find() not findIndex()
No I was trying to accomplish making a bot where you fight bosses and have mentors to get jutsu and I was gonna start with save data I tested my code by making a command that gives me coins and it changed the main variable meaning every user would share the same variable and I didn't wanna do it like that
Im gonna retry using bdscript