Skip to content

tnt-dev/etelegram

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

etelegram

Build Status

An Erlang wrapper around the Telegram Bot API.

Installation

Download the sources from repository and run make.

Or add it to rebar.config into a deps list

{etelegram, ".*",
 {git, "git://github.com/tnt-dev/etelegram.git", {branch, "master"}}}

Configuration

Add in your config

{etelegram, [{token, <<"YOUR_BOT_TOKEN">>}]}

or configure it using application:set_env/3:

1> application:load(etelegram).
2> application:set_env(etelegram, token, <<"YOUR_BOT_TOKEN">>).

Usage

Add etelegram to the application property in your appname.app.src or start it manually:

3> etelegram:start().

Examples

4> etelegram:get_me().
{ok,#etelegram_user{id = 1010,
                    first_name = <<"Foo">>,last_name = undefined,
                    username = <<"foobot">>}}
5> etelegram:send_message(1001, <<"Hello!">>).
{ok,#etelegram_message{message_id = 1,
                       from = #etelegram_user{id = 1010,
                                              first_name = <<"Foo">>,last_name = undefined,
                                              username = <<"foobot">>},
                       date = 1450640539,
                       chat = #etelegram_chat{id = 1001,type = <<"private">>,
                                              title = undefined,username = <<"bar">>,
                                              first_name = <<"Bar">>, last_name = undefined},
                       forward_from = undefined,forward_date = undefined,
                       reply_to_message = undefined,text = <<"Hello!">>,
                       audio = undefined,document = undefined,photo = undefined,
                       sticker = undefined,video = undefined,voice = undefined,
                       caption = undefined,contact = undefined,
                       location = undefined,new_chat_participant = undefined,
                       left_chat_participant = undefined,
                       new_chat_title = undefined,new_chat_photo = undefined,
                       delete_chat_photo = undefined,
                       group_chat_created = undefined}}

About

An Erlang wrapper around the Telegram Bot API

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published