rockneurotiko / ex_gram

Telegram Bot API low level API and framework
183 stars 26 forks source link

Problem with send_media_group #119

Closed prtngn closed 1 year ago

prtngn commented 1 year ago

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}]})
rockneurotiko commented 1 year ago

Can you try with master ?

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

prtngn commented 1 year ago

I'm already on master branch )

rockneurotiko commented 1 year ago

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 1 year ago

Yep. It's working ) Thanks.