hamilton v0.3.1
hamilton
Crystal wrapper for Telegram Bot API with optional async execution.
Installation
-
Add the dependency to your
shard.yml:dependencies: hamilton: github: Scurrra/hamilton -
Run
shards install
Usage
require "hamilton"
API = Hamilton::Api.new(token: "<YOUR-API-TOKEN>")
handler = Hamilton::CmdHandler.new
@[Handler(handler)]
@[Handle(command: "/start")]
def handle_start_command(argument, context, update)
# logic here
return nil
end
@[Handler(handler)]
@[Handle(command: "help")]
def handle_help_command(argument, context, update)
# logic here
return nil
end
bot = Hamilton::Bot.new(
api: API,
handlers: [
Hamilton::LogHandler.new,
handler
]
)
Signal::INT.trap do
bot.stop
end
bot.listen
Usage guide with detailed explanation and example of the async bot can be found here.
Possible issues:
- Sending files were not tested yet, so it may fail.
Contributing
- Fork it (https://github.com/Scurrra/hamilton/fork)
- Create your feature branch (
git checkout -b my-new-feature) - Commit your changes (
git commit -am 'Add some feature') - Push to the branch (
git push origin my-new-feature) - Create a new Pull Request
Contributors
- Scurrra - creator and maintainer
Repository
hamilton
Owner
Statistic
- 0
- 0
- 1
- 0
- 0
- 15 days ago
- August 20, 2025
License
MIT License
Links
Synced at
Fri, 28 Nov 2025 11:05:48 GMT
Languages