user13880771
user13880771

Reputation:

Incorrect name when inputting to firebase [JS ISSUE]

I'm trying to make a played command (if any of you have used it on tatsu, now deprecated)

I'm trying to add games into a firebase database, but I am unable to name it correctly.

The code is:

let currentname = (m.game.name).toString()
db.collection('bde').doc(m.id).get().then((q) => {
  if (!q.exists) {
    db.collection('bde').doc(m.id).set({

    })
  }
  db.collection('bde').doc(m.id).update({
    currentname
  }).then(
    console.log('wrote')
  )
})

The part let currentname = (m.game.name).toString(), gets the name of the current game, but when put into the DB, it saves like:

currentName: "Visual Studio Code"

It inputs as currentname: "Visual Studio Code", I need it to input as [whatever the game is]: 'time'

I am unable to put m.game.name, as it does this.

https://media.discordapp.net/attachments/712144167656226866/750477983168593980/unknown.png

Please let me know if you know a solution to this.

Upvotes: 0

Views: 43

Answers (0)

Related Questions