-
Notifications
You must be signed in to change notification settings - Fork 26
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Constructing a new poll #66
Comments
👋🏼 To create a poll you have to use the sendPoll method: method(
:post,
"sendPoll",
[
{chat_id, [:integer, :string]},
{question, [:string]},
{options, [{:array, :string}]},
{is_anonymous, [:boolean], :optional},
{type, [:string], :optional},
{allows_multiple_answers, [:boolean], :optional},
{correct_option_id, [:integer], :optional},
{explanation, [:string], :optional},
{explanation_parse_mode, [:string], :optional},
{explanation_entities, [{:array, MessageEntity}], :optional},
{open_period, [:integer], :optional},
{close_date, [:integer], :optional},
{is_closed, [:boolean], :optional},
{disable_notification, [:boolean], :optional},
{reply_to_message_id, [:integer], :optional},
{allow_sending_without_reply, [:boolean], :optional},
{reply_markup, [InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove, ForceReply],
:optional}
],
ExGram.Model.Message
) Something like:
You can find the method's help in the iex repl: iex(8)> h ExGram.send_poll
def send_poll(chat_id, question, options, options \\ [])
@spec send_poll(
chat_id :: integer() | String.t(),
question :: String.t(),
options :: [String.t()],
options :: [
is_anonymous: boolean(),
type: String.t(),
allows_multiple_answers: boolean(),
correct_option_id: integer(),
explanation: String.t(),
explanation_parse_mode: String.t(),
explanation_entities: [ExGram.Model.MessageEntity.t()],
open_period: integer(),
close_date: integer(),
is_closed: boolean(),
disable_notification: boolean(),
reply_to_message_id: integer(),
allow_sending_without_reply: boolean(),
reply_markup:
ExGram.Model.InlineKeyboardMarkup.t()
| ExGram.Model.ReplyKeyboardMarkup.t()
| ExGram.Model.ReplyKeyboardRemove.t()
| ExGram.Model.ForceReply.t(),
adapter: atom(),
bot: atom(),
token: String.t(),
debug: boolean(),
check_params: boolean()
]
) :: {:ok, ExGram.Model.Message.t()} | {:error, ExGram.Error.t()}
Check the documentation of this method in
https://core.telegram.org/bots/api#sendpoll |
You can ask all the questions you want, no problem. In order to avoid repetition, this library uses scraping + macros to create the basic models and functionality. In fact, this line creates the method EDIT: Currently there are 77 methods, maybe you are not finding it because of the formatter the line has a line break |
Line Break it was! I just skimmed through the Thank you so much! |
I usually specify them as a keyword list, I think you can use a map too, but as a keyword list is cleaner:
|
This helps! Thanks. |
What methods are available for making new
poll
?I can see
implemented. What's the corresponding function?
The text was updated successfully, but these errors were encountered: