Faraday::Request (Faraday::Error)
natandiasm opened this issue · comments
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 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:in request' 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:in block 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:in new' 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:in conn' 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:in method_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:in listen' from main.rb:6:in
block in
from /usr/local/lib/ruby/gems/3.0.0/gems/telegram-bot-ruby-0.16.0/lib/telegram/bot/client.rb:18:in
run' 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 `'
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