so i'm stuck with this error. I am creating a bot telegram with an api bot telegram, and now I am trying to create a firebae database in order to keep the group memberβs score, so the account does not restart after the bot is restarted. can someone tell me what the problem is? I read many other problems here with similar problems, but none of these answers fixed my problem.
bot.js
var TelegramBot = require('node-telegram-bot-api'); var firebase = require('firebase'); var token = 'mytoken'; // Setup polling way var bot = new TelegramBot(token, {polling: true}); var app = firebase.intializeApp({ serviceAccount: "C:/Mayer/scorebot/telegramscorebot.json", databaseURL: "https://blazing-heat-2008.firebaseio.com/" }); /* function Person(name, score) { this.name = name; this.score = score; } var member = new Array(); member[0] = new Person("name1", 0); member[1] = new Person("name2", 0); member[2] = new Person("name3", 0); member[3] = new Person("name4", 0); member[4] = new Person("name5", 0); */ bot.onText(/\/echo (.+)/, function (msg, match) { var fromId = msg.from.id; if (match[1] == 'test') { var resp = match[1]; bot.sendMessage(fromId, resp); } else { bot.sendMessage(fromId, 'error!!');} }); bot.onText(/\/vote (.+)/, function (msg, match) { var fromId = msg.from.id; for (var i = 0; i <= 4; i++) { if(member[i].name == match[1]){ member[i].score += 1; bot.sendMessage(fromId, member[i].name + ' hat einen Score von ' + member[i].score);} } });
package.json
{ "name": "scorebot", "version": "1.0.0", "description": "", "main": "bot.js", "scripts": { "test": "echo \"Error: no test specified\" && exit 1", "start": "node bot.js" }, "author": "me", "license": "ISC", "dependencies": { "bower": "1.7.9", "firebase": "3.0.2" } }
Error message
bot.js:8 var app = firebase.intializeApp({ ^ TypeError: firebase.intializeApp is not a function at Object.<anonymous> (C:\Mayer\scorebot\bot.js:8:20) at Module._compile (module.js:413:34) at Object.Module._extensions..js (module.js:422:10) at Module.load (module.js:357:32) at Function.Module._load (module.js:314:12) at Function.Module.runMain (module.js:447:10) at startup (node.js:141:18) at node.js:933:3
fak3d source share