nadia icon indicating copy to clipboard operation
nadia copied to clipboard

Nadia.send_message fix spec

Open dog-64 opened this issue 7 years ago • 5 comments

dog-64 avatar Oct 11 '18 12:10 dog-64

Hi

can we communicate in russian?

About PR:

I can use:

Nadia.send_message("@StarsOfAwesomeElixir", "bot test")

But in dialyzer tests:

lib/awe2/db/git_telegram.ex:77: The call 'Elixir.Nadia':send_message(#{#<64>(8, 1, 'integer', ['unsigned', 'big']), #<83>(8, 1, 'integer', ['unsigned', 'big']), #<116>(8, 1, 'integer', ['unsigned', 'big']), #<97>(8, 1, 'integer', ['unsigned', 'big']), #<114>(8, 1, 'integer', ['unsigned', 'big']), #<115>(8, 1, 'integer', ['unsigned', 'big']), #<79>(8, 1, 'integer', ['unsigned', 'big']), #<102>(8, 1, 'integer', ['unsigned', 'big']), #<65>(8, 1, 'integer', ['unsigned', 'big']), #<119>(8, 1, 'integer', ['unsigned', 'big']), #<101>(8, 1, 'integer', ['unsigned', 'big']), #<115>(8, 1, 'integer', ['unsigned', 'big']), #<111>(8, 1, 'integer', ['unsigned', 'big']), #<109>(8, 1, 'integer', ['unsigned', 'big']), #<101>(8, 1, 'integer', ['unsigned', 'big']), #<69>(8, 1, 'integer', ['unsigned', 'big']), #<108>(8, 1, 'integer', ['unsigned', 'big']), #<105>(8, 1, 'integer', ['unsigned', 'big']), #<120>(8, 1, 'integer', ['unsigned', 'big']), #<105>(8, 1, 'integer', ['unsigned', 'big']), #<114>(8, 1, 'integer', ['unsigned', 'big'])}#,text@1::binary(),[{'parse_mode',<<:32>>},...]) breaks the contract (integer(),binary(),[{atom(),any()}]) -> {'ok','Elixir.Nadia.Model.Message':t()} | {'error','Elixir.Nadia.Model.Error':t()} lib/mix/vup.ex:1: Callback info about the 'Elixir.Mix.Task' behaviour is not available

May by change of send_message to

  @spec send_message(integer | binary, binary, [{atom, any}]) :: {:ok, Message.t()} | {:error, Error.t()}

will solve this problem?

Oleg Duletsky

11 окт. 2018 г., 14:45 +0200, Alex Filatov [email protected], писал:

@alexfilatov commented on this pull request. In lib/nadia.ex:

@@ -39,7 +39,7 @@ defmodule Nadia do force a reply from the user - Nadia.Model.ReplyKeyboardMarkup or Nadia.Model.ReplyKeyboardHide or Nadia.Model.ForceReply """

  • @spec send_message(integer, binary, [{atom, any}]) :: {:ok, Message.t()} | {:error, Error.t()}
  • @spec send_message(integer | binary, binary, [{atom, any}]) :: {:ok, Message.t()} | {:error, Error.t()} hey @dog-64 , just curious, this is kind of a significant change, what stays behind it could you please give more details? thanks a lot! — You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.

dog-64 avatar Oct 11 '18 12:10 dog-64

yeah, this makes sense for me now, thanks! yes, we can communicate in Russian but here would be better in English =)

alexfilatov avatar Oct 11 '18 13:10 alexfilatov

According to the documentation of telegram api, it's integer or string, so it makes sense this change 😄

https://core.telegram.org/bots/api#available-methods

P.S: I prefer English, I have no idea of Russian 😂

rockneurotiko avatar Oct 11 '18 13:10 rockneurotiko

11 окт. 2018 г., 15:05 +0200, Rock Neurotiko (Miguel G) [email protected], писал:

According to the documentation of telegram api, it's integer or string, so it makes sense this change 😄 my tests will be happy

https://core.telegram.org/bots/api#available-methods P.S: I prefer English, I have no idea of Russian 😂 Sorry, message about Russian for Alex Filatov — You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.

dog-64 avatar Oct 11 '18 13:10 dog-64

Hi, @dog-64

Thanks for contributing.

It seems your changes failed to pass the format check. Would you please look into it?

zhyu avatar Oct 12 '18 03:10 zhyu