Closed natandiasm closed 2 years ago
Looks like multipart middleware was removed from Faraday 2.0.0 version (released today). You can avoid this error by using 1.8 version (add next line to your Gemfile: gem "faraday", "~> 1.8.0"
).
this work, thks.
But I think this issue should not be closed and telegram-bot-ruby
should be adapted to latest stable version of faraday
?
yes I agree with you
My code:
require 'telegram/bot'
token = 'real_token'
Telegram::Bot::Client.run(token) do |bot| bot.listen do |message| case message.text when '/start' bot.api.send_message(chat_id: message.chat.id, text: "Hello, #{message.from.first_name}") when '/stop' bot.api.send_message(chat_id: message.chat.id, text: "Bye, #{message.from.first_name}") end end end
error:
/usr/local/lib/ruby/gems/3.0.0/gems/faraday-2.0.0/lib/faraday/middleware_registry.rb:57:in'
from /usr/local/lib/ruby/gems/3.0.0/gems/telegram-bot-ruby-0.16.0/lib/telegram/bot/client.rb:18:in '
lookup_middleware': :multipart is not registered on Faraday::Request (Faraday::Error) from /usr/local/lib/ruby/gems/3.0.0/gems/faraday-2.0.0/lib/faraday/rack_builder.rb:242:in
use_symbol' from /usr/local/lib/ruby/gems/3.0.0/gems/faraday-2.0.0/lib/faraday/rack_builder.rb:103:inrequest' from /usr/local/Cellar/ruby/3.0.1/lib/ruby/3.0.0/forwardable.rb:238:in
request' from /usr/local/lib/ruby/gems/3.0.0/gems/telegram-bot-ruby-0.16.0/lib/telegram/bot/api.rb:86:inblock in conn' from /usr/local/lib/ruby/gems/3.0.0/gems/faraday-2.0.0/lib/faraday/connection.rb:91:in
initialize' from /usr/local/lib/ruby/gems/3.0.0/gems/faraday-2.0.0/lib/faraday.rb:94:innew' from /usr/local/lib/ruby/gems/3.0.0/gems/faraday-2.0.0/lib/faraday.rb:94:in
new' from /usr/local/lib/ruby/gems/3.0.0/gems/telegram-bot-ruby-0.16.0/lib/telegram/bot/api.rb:85:inconn' from /usr/local/lib/ruby/gems/3.0.0/gems/telegram-bot-ruby-0.16.0/lib/telegram/bot/api.rb:49:in
call' from /usr/local/lib/ruby/gems/3.0.0/gems/telegram-bot-ruby-0.16.0/lib/telegram/bot/api.rb:37:inmethod_missing' from /usr/local/lib/ruby/gems/3.0.0/gems/telegram-bot-ruby-0.16.0/lib/telegram/bot/client.rb:30:in
fetch_updates' from /usr/local/lib/ruby/gems/3.0.0/gems/telegram-bot-ruby-0.16.0/lib/telegram/bot/client.rb:25:inlisten' from main.rb:6:in
block inrun' from /usr/local/lib/ruby/gems/3.0.0/gems/telegram-bot-ruby-0.16.0/lib/telegram/bot/client.rb:8:in
run' from main.rb:5:in `