https://github.com/tnt-dev/etelegram
An Erlang wrapper around the Telegram Bot API
https://github.com/tnt-dev/etelegram
telegram
Last synced: about 1 month ago
JSON representation
An Erlang wrapper around the Telegram Bot API
- Host: GitHub
- URL: https://github.com/tnt-dev/etelegram
- Owner: tnt-dev
- License: mit
- Created: 2015-12-21T22:26:58.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2016-04-20T11:12:56.000Z (about 9 years ago)
- Last Synced: 2024-11-01T07:33:13.432Z (6 months ago)
- Topics: telegram
- Language: Erlang
- Size: 22.5 KB
- Stars: 6
- Watchers: 3
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-telegram - etelegram - Erlang (Bot Libraries)
- awesome-telegram - etelegram - An Erlang wrapper by [Pavel Abalikhin](https://github.com/tnt-dev). (Bot Libraries / Unofficial)
README
# etelegram
[![Build Status][travis-img]][travis]
[travis]: https://travis-ci.org/tnt-dev/etelegram
[travis-img]: https://travis-ci.org/tnt-dev/etelegram.svgAn Erlang wrapper around the
[Telegram Bot API](https://core.telegram.org/bots/api).## Installation
Download the sources from [repository](https://github.com/tnt-dev/etelegram)
and run `make`.Or add it to `rebar.config` into a `deps` list
```erlang
{etelegram, ".*",
{git, "git://github.com/tnt-dev/etelegram.git", {branch, "master"}}}
```## Configuration
Add in your config
```erlang
{etelegram, [{token, <<"YOUR_BOT_TOKEN">>}]}
```or configure it using `application:set_env/3`:
```erlang
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:```erlang
3> etelegram:start().
```## Examples
```erlang
4> etelegram:get_me().
{ok,#etelegram_user{id = 1010,
first_name = <<"Foo">>,last_name = undefined,
username = <<"foobot">>}}
``````erlang
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}}
```