/nadia

Telegram Bot API Wrapper written in Elixir

Primary LanguageElixir

Nadia Build Status Deps Status Inline docs Hex pm Hex.pm

Telegram Bot API Wrapper written in Elixir (document)

Installation

Add Nadia to your mix.exs dependencies:

def deps do
  [{:nadia, "~> 0.3"}]
end

and run $ mix deps.get.

Configuration

In config/config.exs, add your Telegram Bot token like this

config :nadia,
  token: "bot token"

You can also add an optional recv_timeout in seconds (defaults to 5s).

config :nadia,
  recv_timeout: 10

And then, in mix.exs, list :nadia as an application inside application/0:

def application do
  [applications: [:nadia]]
end

Now Mix will guarantee the :nadia application is started before your application is started.

Usage

get_me

iex(1)> Nadia.get_me
{:ok,
 %Nadia.Model.User{first_name: "Nadia", id: 666, last_name: nil,
  username: "nadia_bot"}}

Refer to Nadia document and Telegram Bot API document for more details.