I'm making a discord.js v13 bot right now and I want to send the user's messages from the specific channel to my website. I found a Firebase service as the easiest way to do that. I watched and repeated everything from this video: https://www.youtube.com/watch?v=UoNm4z-4Bko But unfortunately, I struggle with the Firebase installation for 16 last hours.
TypeError: firebase.database(...).goOfline is not a function at Client.
I'm new to programming and I don't have a good base, any of your help is appreciated. Let me know if I can provide some additional information.
To install Firebase I used
npm i firebase@8.10.0
Here is the rest of the code I used on my index.js:
const firebase = require('firebase');
const randomstring = require('randomstring');
const config = {
------------------------------
CONFIGURATION DATA IS HERE
------------------------------
};
firebase.initializeApp(config);
const database = firebase.database();
client.on ("message", async message => {
if (message.author === client.user) {
return;
}
try {
let ticket = randomstring.generate(7);
firebase.database().goOnline();
await database.ref('/Auction4/' + ticket).set({
Message: message.content,
User: message.author.username,
User_ID: message.author.id
})
firebase.database().goOfline();
await client.channels.cache.get(`xxxxxxxxxxxxxxxxx`).send(`Thanks, it works!`);
}
catch (err) {
console.log(err);
}
});