class
Telecr::Core::Bot
- Telecr::Core::Bot
- Reference
- Object
Overview
Main bot class that users interact with
Defined in:
core/bot.crConstructors
-
.new(token : String)
Initialize a new bot with your Telegram token
Instance Method Summary
-
#chat_boost(&block)
Handle chat boosts
-
#chat_join_request(&block)
Handle chat join requests
-
#client : Telecr::Api::Client
Core components
-
#command(name : String, &block)
Register a command handler (e.g.
- #composer : Composer
-
#contact(**options, &block)
Handle contact sharing
-
#create_forum_topic(chat_id, name, **options)
Create a forum topic
-
#error(&block)
Set custom error handler
-
#get_user_profile_audios(user_id : String, **options)
Get user's profile audios
-
#hears(pattern, &block)
Register a handler for messages matching a pattern
-
#location(&block)
Handle location messages
-
#message_reaction(&block)
Handle message reactions
-
#message_reaction_count(&block)
Handle message reaction counts
-
#on(type, **filters, &block)
Generic handler registration
-
#poll_answer(&block)
Handle poll answers
-
#pre_checkout_query(&block)
Handle pre-checkout queries
-
#process(update_data)
Process raw update data (useful for webhooks)
-
#remove_my_profile_photo
Remove bot profile photo
-
#removed_chat_boost(&block)
Handle removed chat boosts
- #running : Bool
-
#set_my_profile_photo(photo, **options)
Set bot profile photo
-
#shipping_query(&block)
Handle shipping queries
-
#shutdown
Gracefully stop the bot
-
#start_polling
Start bot in polling mode (runs in background)
-
#start_webhook(path : String = "/webhook", port : Int32 | Nil = nil, host : String = "0.0.0.0", ssl : Bool | Hash(Symbol, String) | Nil = nil, secret_token : String | Nil = nil, logger : Logger | Nil = nil)
Start bot in webhook mode
-
#stop_webhook
Stop webhook server
-
#use(middleware : Middleware)
Add middleware to the chain
-
#web_app_data(&block)
Handle web app data
- #webhook_path : String | Nil
- #webhook_server : Webhook::Server | Nil
Constructor Detail
Instance Method Detail
Start bot in webhook mode