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.35k stars 218 forks source link

method get chat member not found #156

Closed mm580486 closed 1 year ago

mm580486 commented 6 years ago

hi guys

i want check a channel if user joined to channel user can be continue to use bot i found this example on this issue https://github.com/atipugin/telegram-bot-ruby/issues/124

def get_chat_member resp = BOT.api.get_chat_member(chat_id: "@caffe_fan", user_id: message.from.id) return unless resp['ok'] member = Telegram::Bot::Types::ChatMember.new(resp['result']) //<Telegram::Bot::Types::ChatMember:0x007febce2a55a0 @user=#<Telegram::Bot::Types::User:0x007febce2a4010 @id=xxxxxxxxx, @first_name="Aleksey", @username="", @last_name=nil>, @status="member"> // do something here end

but this code return this error

bot.rb:31:inblock (2 levels) in

': undefined method get_chat_member' for Telegram::Bot::Api:Class (NoMethodError) from /Users/mac/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/telegram-bot-ruby-0.3.11/lib/telegram/bot/client.rb:41:inblock in fetch_updates' `

please help me to fix this error oy another way to check user on channel thanks

ivanovaleksey commented 6 years ago

According to error message you are using 0.3.11 version. Current version is 0.8.4. I think updating the gem would solve the issue.

Also please use ``` for multiline code formatting.

github-actions[bot] commented 1 year ago

This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 7 days.