ruby - 如何将红宝石中的电报机器人上传到heroku
问题描述
我无法将用 ruby 制作的简单电报机器人部署到 heroku,而且我找不到任何使其工作的文档或示例。我只有4个文件:
档案
worker: bundle exec ruby src/bot.rb
宝石文件
source 'https://rubygems.org'
ruby '2.6.3'
gem 'telegram_bot'
Gemfile.lock,当我运行“捆绑安装”时生成
src/bot.rb
require 'telegram_bot'
token = ENV['BOT_TOKEN']
bot = TelegramBot.new(token: token)
bot.get_updates(fail_silently: true) do |message|
#do some stuff
end
当我运行 git push heroku main 时,出现以下错误:
remote: Building source:
remote:
remote: -----> Building on the Heroku-20 stack
remote: -----> Determining which buildpack to use for this app
remote: ! No default language could be detected for this app.
remote: HINT: This occurs when Heroku cannot detect the buildpack to use for this application automatically.
remote: See https://devcenter.heroku.com/articles/buildpacks
remote:
remote: ! Push failed
remote: Verifying deploy...
remote:
remote: ! Push rejected to my-bot.
remote:
To https://git.heroku.com/my-bot.git
如果我手动添加 buildpack,它说不兼容,没有检测到这是一个 ruby 项目。例如,如果我添加一个 package.json 文件,它会部署 OK,将其标识为 nodejs,而当我运行它时,它会失败,因为未识别 require。
我究竟做错了什么?
解决方案
推荐阅读
- python - 文件未正确到达
- python - 另一个线程在等待 HTTP 响应时会执行另一个线程吗?
- jquery - jquery重置数组中的所有输入字段
- c++ - 选择排序时交换函数调用的次数和完成的交换次数是否相同?
- android - 地图类型 GoogleMap.MAP_TYPE_NONE 的 Google 地图背景颜色
- c++ - cudaMalloc() 是否将数组初始化为 0?
- swift - 如何在主线程(Swift)中等待异步 Firebase 调用
- python - 为什么我不能显示加载的腌制深度学习模型的分数?
- electron - 为什么 Select2 不会覆盖 Electron 中的正常选择框?
- python - Pandas str.replace 完全匹配重复字符