百科.dev
全部条目在线工具AI 编程趋势榜开源项目技术资讯提交条目
登录
< 返回工具列表
T

telegram_bot_app

> 编程语言
开源

Rails 5 Telegram 机器人应用示例

99 stars0 点赞2 次浏览
访问官网GitHub

工具介绍

Rails 5 Telegram 机器人应用示例

Example telegram bot app

This app uses telegram-bot gem. Want to see the bot code first?

Explore separate commits to check evolution of code.

Want a clean setup instead? Here is app teamplate to help you.

Commands

  • /start - Greeting.
  • /help
  • /memo %text% - Saves text to session.
  • /remind_me - Replies with text from session.
  • /keyboard - Simple keyboard.
  • /inline_keyboard - Inline keyboard example.
  • Inline queries. Enable it in @BotFather, and your're ready to try 'em.
  • /last_chosen_inline_result - Your last chosen inline result (Enable feedback with sending /setinlinefeedback to @BotFather).

Setup

  • Create bot with @BotFather unless has_test_bot?
  • Clone repo.
  • run ./bin/setup.
  • Update config/secrets.yml with your bot's token.

Run

Development

bin/rake telegram:bot:poller

Production

One way is just to run poller. You don't need anything else, just check your production secrets & configs. But there is better way: use webhooks.

You may want to use different token: after you setup the webhook, you need to unset it to run development poller again.

First you need to setup the webhook. There is rake task for it, but you're free to set it manually with API call. To use rake task you need to set host in routes.default_url_options for production environment (config.routes for Rails < 5). There is already such line in the repo in production.rb. Uncomment it, change the values, and you're ready for:

bin/rake telegram:bot:set_webhook RAILS_ENV=production

Now deploy your app in any way you like. You don't need run anything special for bot, but rails server as usual. Your rails app will receive webhooks and bypass them to bot's controller.

By default session is configured to use FileStore at Rails.root.join('tmp', 'session_store'). To use it in production make sure to share this folder between releases (ex., add to list shared of shared folders in capistrano). Read more about different session stores in original readme.

Testing

bin/rspec

Advanced

Async mode

  • Uncomment async: true in secrets.yml.
  • Run and check the logs out.
  • More info about async mode.

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/telegram-bot-rb/telegram_bot_app.

Issues· 0 开放

查看全部 Issues在 GitHub 打开

暂无开放 Issues,或尚未同步最近议题。

> 标签

Ruby

暂无评论,来聊聊你的看法吧

> 工具信息

发布日期2026年8月1日
最后更新2026年9月18日
分类编程语言
定价开源

> 相关工具

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言