Current section

Files

Jump to
nadia lib nadia.ex
Raw

lib/nadia.ex

defmodule Nadia do
@moduledoc """
Provides access to Telegram Bot API.
"""
defmodule User do
defstruct id: nil, first_name: nil, last_name: nil, username: nil
@type t :: %User{id: integer, first_name: binary, last_name: binary, username: binary}
end
defmodule GroupChat do
defstruct id: nil, title: nil
@type t :: %GroupChat{id: integer, title: binary}
end
defmodule PhotoSize do
defstruct file_id: nil, width: nil, height: nil, file_size: nil
@type t :: %PhotoSize{file_id: binary, width: integer, height: integer, file_size: integer}
end
defmodule Audio do
defstruct file_id: nil, duration: nil, performer: nil, title: nil, mime_type: nil, file_size: nil
@type t :: %Audio{file_id: binary, duration: integer, performer: binary, title: binary,
mime_type: binary, file_size: integer}
end
defmodule Document do
defstruct file_id: nil, thumb: nil, file_name: nil, mime_type: nil, file_size: nil
@type t :: %Document{file_id: binary, thumb: PhotoSize.t, file_name: binary, mime_type: binary, file_size: integer}
end
defmodule Sticker do
defstruct file_id: nil, width: nil, height: nil, thumb: nil, file_size: nil
@type t :: %Sticker{file_id: binary, width: integer, height: integer, thumb: PhotoSize.t, file_size: integer}
end
defmodule Video do
defstruct file_id: nil, width: nil, height: nil, duration: nil, thumb: nil, mime_type: nil, file_size: nil
@type t :: %Video{file_id: binary, width: integer, height: integer, duration: integer, thumb: PhotoSize.t,
mime_type: binary, file_size: integer}
end
defmodule Voice do
defstruct file_id: nil, duration: nil, mime_type: nil, file_size: nil
@type t :: %Voice{file_id: binary, duration: integer, mime_type: binary, file_size: integer}
end
defmodule Contact do
defstruct phone_number: nil, first_name: nil, last_name: nil, user_id: nil
@type t :: %Contact{phone_number: binary, first_name: binary, last_name: binary, user_id: integer}
end
defmodule Location do
defstruct latitude: nil, longitude: nil
@type t :: %Location{latitude: float, longitude: float}
end
defmodule Message do
defstruct message_id: nil, from: nil, date: nil, chat: nil, forward_from: nil,
forward_date: nil, reply_to_message: nil, text: nil, audio: nil, document: nil,
photo: [], sticker: nil, video: nil, voice: nil, caption: nil, contact: nil,
location: nil, new_chat_participant: nil, left_chat_participant: nil,
new_chat_title: nil, new_chat_photo: [], delete_chat_photo: nil, group_chat_created: nil
@type t :: %Message{message_id: integer, from: User.t, date: integer, chat: User.t | GroupChat.t,
forward_from: User.t, forward_date: integer, reply_to_message: Message.t,
text: binary, audio: Audio.t, document: Document.t, photo: [PhotoSize.t], sticker: any,
video: any, voice: any, caption: binary, contact: any, location: any,
new_chat_participant: User.t, left_chat_participant: User.t, new_chat_title: binary,
new_chat_photo: [PhotoSize.t], delete_chat_photo: atom, group_chat_created: atom}
end
defmodule Update do
defstruct update_id: nil, message: nil
@type t :: %Update{update_id: integer, message: Message.t}
end
defmodule UserProfilePhotos do
defstruct total_count: nil, photos: []
@type t :: %UserProfilePhotos{total_count: integer, photos: [[PhotoSize.t]]}
end
defmodule Error do
defexception reason: nil
@type t :: %Error{reason: any}
def message(%Error{reason: reason}), do: inspect(reason)
end
use Nadia.API
end