atipugin / telegram-bot-ruby

Ruby wrapper for Telegram's Bot API
https://core.telegram.org/bots/api
Do What The F*ck You Want To Public License
1.36k stars 222 forks source link

(ArgumentError) when using get_chat_member #183

Closed elisaado closed 6 years ago

elisaado commented 6 years ago

Hi, when I do

bot.api.getChatMember(message.chat.id, message.from.id)

the bot crashes with this error:

Traceback (most recent call last):
    10: from main.rb:12:in `<main>'
     9: from /home/eli/.gem/ruby/2.5.0/gems/telegram-bot-ruby-0.8.6.1/lib/telegram/bot/client.rb:8:in `run'
     8: from /home/eli/.gem/ruby/2.5.0/gems/telegram-bot-ruby-0.8.6.1/lib/telegram/bot/client.rb:18:in `run'
     7: from main.rb:13:in `block in <main>'
     6: from /home/eli/.gem/ruby/2.5.0/gems/telegram-bot-ruby-0.8.6.1/lib/telegram/bot/client.rb:25:in `listen'
     5: from /home/eli/.gem/ruby/2.5.0/gems/telegram-bot-ruby-0.8.6.1/lib/telegram/bot/client.rb:33:in `fetch_updates'
     4: from /home/eli/.gem/ruby/2.5.0/gems/telegram-bot-ruby-0.8.6.1/lib/telegram/bot/client.rb:33:in `each'
     3: from /home/eli/.gem/ruby/2.5.0/gems/telegram-bot-ruby-0.8.6.1/lib/telegram/bot/client.rb:38:in `block in fetch_updates'
     2: from main.rb:22:in `block (2 levels) in <main>'
     1: from /home/eli/.gem/ruby/2.5.0/gems/telegram-bot-ruby-0.8.6.1/lib/telegram/bot/api.rb:60:in `method_missing'
/home/eli/.gem/ruby/2.5.0/gems/telegram-bot-ruby-0.8.6.1/lib/telegram/bot/api.rb:70:in `call': wrong number of arguments (given 3, expected 1..2) (ArgumentError)
atipugin commented 6 years ago

Try bot.api.getChatMember(chat_id: message.chat.id, user_id : message.from.id)

elisaado commented 6 years ago

Thank you, that fixed it!