我在Heroku 运行一个telegram bot
vianode.js
我想要真实的假值,并在本地可以,但不能在heroku工作。 该怎么办?
let p = false;
bot.onText(/\/book/, (msg) => {
bot.sendMessage(msg.chat.id, 'This is your Book'); // ok
p = true; // not work in Heroku and still is false
});
bot.on('message', (msg) => {
bot.sendMessage(msg.chat.id, p); // p is still false
p = false;
});
package.json:
"scripts": {
"update:packages": "npm update --save-dev && npm update --save",
"prebuild": "npm run clean",
"preinstall": "npm install pm2 -g",
"start": "pm2-runtime src/index.js -i max",
"test": "eslint .",
"build": "cross-env NODE_ENV=production babel --out-dir lib src",
"dev": "cross-env NODE_ENV=development babel-watch src/index.js",
"dev-inspect": "cross-env NODE_ENV=development babel-watch --inspect --debug-brk src/index.js",
"clean": "rimraf lib"
},
发布于 2018-10-09 15:36:14
bundle exec rake assets:precompile
然后尝试添加它
git add -A
git commit -m "precompile"
git push heroku master
设置config.assets.compile = true
在配置/环境/ production.rb并重新启动服务器
https://stackoverflow.com/questions/-100002863
复制相似问题