An OTP application for sending messages in telegram channels.
You can define max telegram workers in sys.config. By default it number of yours machine CPUs:
{pechkin, [
{max_workers, "${MAX_WORKERS}"}
]}
Workers are taken from the pool by round-robin.
In future pechkin will be distributed, but now you can include him in release.
Add dependency in deps section of yours rebar.config
{deps, [
{pechkin, {git, "git://github.com/stleon/pechkin.git", {tag, "0.0.1"}}}
]
}.
And in relx section add pechkin to list of applications that be included in the release:
{relx, [{release, { release_name, "vsn" },
[sasl,
pechkin
...]},
Then in app.src add pechkin:
{applications,
[kernel,
stdlib,
pechkin
]},
Here is some workflow (if you run from shell) :
1> rr("include/pechkin.hrl").
2> ApiKey = <<"bot_api_key">>.
3> Text = <<"Hello, world!">>.
4> Channel = <<"@channel_name">>. %% or id
5> Message = #telegram_message{apikey = ApiKey, channel = Channel, text = Text}.
6> pechkin:send(Message).
- http API
- balancer (if there are many pechkins in the cluster)