rockneurotiko/ex_gram

Problem with send_media_group

prtngn opened this issue · 4 comments

prtngn commented

I'll try to send media_group with photos or documents and get same error:

      ExGram.send_media_group(
        user.telegram_id,
        media: [
          %ExGram.Model.InputMediaDocument{
            type: "document",
            media: "BQACAgIAAxkBAAEGtFRkU7LYwc22u650vKUZ9hzUAAEl13QAAnAuAAKvw6FKVOYAAbzuWHewLwQ"
          },
          %ExGram.Model.InputMediaDocument{
            type: "document",
            media: "BQACAgIAAxkBAAEBQJpkJtrMNEdgDH1ebZGm4Gpd8GB1EgACbycAAsVbOUlzhwdVzy5QHS8E"
          }
        ],
        bot: Bot.bot()
      )
** (FunctionClauseError) no function clause matching in ExGram.Macros.Checker.check_type/2
    (ex_gram 0.34.0) lib/ex_gram/macros/checker.ex:42: ExGram.Macros.Checker.check_type(InputMediaAudio, {:media, [%ExGram.Model.InputMediaDocument{type: "document", media: "BQACAgIAAxkBAAEGtFRkU7LYwc22u650vKUZ9hzUAAEl13QAAnAuAAKvw6FKVOYAAbzuWHewLwQ", thumbnail: nil, caption: nil, parse_mode: nil, caption_entities: nil, disable_content_type_detection: nil}, %ExGram.Model.InputMediaDocument{type: "document", media: "BQACAgIAAxkBAAEBQJpkJtrMNEdgDH1ebZGm4Gpd8GB1EgACbycAAsVbOUlzhwdVzy5QHS8E", thumbnail: nil, caption: nil, parse_mode: nil, caption_entities: nil, disable_content_type_detection: nil}]})

Can you try with master ?

Replace in mix.exs:
{:ex_gram, github: "rockneurotiko/ex_gram"}

prtngn commented

I'm already on master branch )

Ahhh got it, the media parameter is a mandatory parameter, so you don't call it as a keyword, try this:

 ExGram.send_media_group(
        user.telegram_id,
        [
          %ExGram.Model.InputMediaDocument{
            type: "document",
            media: "BQACAgIAAxkBAAEGtFRkU7LYwc22u650vKUZ9hzUAAEl13QAAnAuAAKvw6FKVOYAAbzuWHewLwQ"
          },
          %ExGram.Model.InputMediaDocument{
            type: "document",
            media: "BQACAgIAAxkBAAEBQJpkJtrMNEdgDH1ebZGm4Gpd8GB1EgACbycAAsVbOUlzhwdVzy5QHS8E"
          }
        ],
        bot: Bot.bot()
      )
prtngn commented

Yep. It's working ) Thanks.