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 223 forks source link

Paid reactions update causing error in GetChat #311

Open ALEKSEYR554 opened 3 months ago

ALEKSEYR554 commented 3 months ago

If you enable paid reaction on your channel and try to getChat this channel it will raise an error You can disable all reaction and reanable without paid reactions and will work as always

#<Thread:0x000002b685f94e10 c:/Users/alefi/Documents/twitter_to_images_telegram/modules/threads.rb:90 run> terminated with exception (report_on_exception is true):
c:/Users/alefi/Documents/twitter_to_images_telegram/modules/listener.rb:45:in `rescue in catch_new_message': undefined method `[]' for #<Dry::Struct::Error: [Telegram::Bot::Types::ReactionTypeCustomEmoji.new] "paid" (String) has invalid type for :type violates constraints (eql?("custom_emoji", "paid") failed)> (NoMethodError)

          Listener.bot.api.send_message(chat_id:TelegramConstants::ERROR_CHANNEL_ID, text:"#{e[0..4000]}")

                                                                                              ^^^^^^^^^
    from c:/Users/alefi/Documents/twitter_to_images_telegram/modules/listener.rb:10:in `catch_new_message'
    from c:/Users/alefi/Documents/twitter_to_images_telegram/modules/threads.rb:90:in `block (2 levels) in main_bot'
C:/Users/alefi/.local/share/gem/ruby/3.2.0/gems/dry-types-1.7.2/lib/dry/types/schema.rb:332:in `rescue in block in resolve_unsafe': [Telegram::Bot::Types::ReactionTypeCustomEmoji.new] "paid" (String) has invalid type for :type violates constraints (eql?("custom_emoji", "paid") failed) (Dry::Struct::Error)
    from C:/Users/alefi/.local/share/gem/ruby/3.2.0/gems/dry-types-1.7.2/lib/dry/types/schema.rb:329:in `block in resolve_unsafe'
    from C:/Users/alefi/.local/share/gem/ruby/3.2.0/gems/dry-types-1.7.2/lib/dry/types/schema.rb:324:in `each'
    from C:/Users/alefi/.local/share/gem/ruby/3.2.0/gems/dry-types-1.7.2/lib/dry/types/schema.rb:324:in `resolve_unsafe'
    from C:/Users/alefi/.local/share/gem/ruby/3.2.0/gems/dry-types-1.7.2/lib/dry/types/schema.rb:60:in `call_unsafe'
    from C:/Users/alefi/.local/share/gem/ruby/3.2.0/gems/dry-types-1.7.2/lib/dry/types/constructor.rb:81:in `call_unsafe'
    from C:/Users/alefi/.local/share/gem/ruby/3.2.0/gems/dry-struct-1.6.0/lib/dry/struct/class_interface.rb:264:in `new'
    from C:/Users/alefi/.local/share/gem/ruby/3.2.0/gems/dry-struct-1.6.0/lib/dry/struct/class_interface.rb:284:in `call_unsafe'
    from C:/Users/alefi/.local/share/gem/ruby/3.2.0/gems/dry-types-1.7.2/lib/dry/types/sum.rb:28:in `block in call_unsafe'
    from C:/Users/alefi/.local/share/gem/ruby/3.2.0/gems/dry-struct-1.6.0/lib/dry/struct/class_interface.rb:262:in `block in new'
    from C:/Users/alefi/.local/share/gem/ruby/3.2.0/gems/dry-types-1.7.2/lib/dry/types/constructor.rb:74:in `block in call_safe'
    from C:/Users/alefi/.local/share/gem/ruby/3.2.0/gems/dry-types-1.7.2/lib/dry/types/schema.rb:69:in `block in call_safe'
    from C:/Users/alefi/.local/share/gem/ruby/3.2.0/gems/dry-types-1.7.2/lib/dry/types/constrained.rb:48:in `call_safe'
    from C:/Users/alefi/.local/share/gem/ruby/3.2.0/gems/dry-types-1.7.2/lib/dry/types/default.rb:114:in `call_safe'
    from C:/Users/alefi/.local/share/gem/ruby/3.2.0/gems/dry-types-1.7.2/lib/dry/types/schema/key.rb:41:in `call_safe'
    from C:/Users/alefi/.local/share/gem/ruby/3.2.0/gems/dry-types-1.7.2/lib/dry/types/schema.rb:359:in `block in resolve_safe'
    from C:/Users/alefi/.local/share/gem/ruby/3.2.0/gems/dry-types-1.7.2/lib/dry/types/schema.rb:354:in `each'
    from C:/Users/alefi/.local/share/gem/ruby/3.2.0/gems/dry-types-1.7.2/lib/dry/types/schema.rb:354:in `resolve_safe'
    from C:/Users/alefi/.local/share/gem/ruby/3.2.0/gems/dry-types-1.7.2/lib/dry/types/schema.rb:69:in `call_safe'
    from C:/Users/alefi/.local/share/gem/ruby/3.2.0/gems/dry-types-1.7.2/lib/dry/types/constructor.rb:74:in `call_safe'
    from C:/Users/alefi/.local/share/gem/ruby/3.2.0/gems/dry-struct-1.6.0/lib/dry/struct/class_interface.rb:262:in `new'
    from C:/Users/alefi/.local/share/gem/ruby/3.2.0/gems/dry-struct-1.6.0/lib/dry/struct/class_interface.rb:275:in `call_safe'
    from C:/Users/alefi/.local/share/gem/ruby/3.2.0/gems/dry-types-1.7.2/lib/dry/types/sum.rb:28:in `call_unsafe'
    from C:/Users/alefi/.local/share/gem/ruby/3.2.0/gems/dry-types-1.7.2/lib/dry/types/array/member.rb:32:in `block in call_unsafe'
    from C:/Users/alefi/.local/share/gem/ruby/3.2.0/gems/dry-types-1.7.2/lib/dry/types/array/member.rb:31:in `each'
    from C:/Users/alefi/.local/share/gem/ruby/3.2.0/gems/dry-types-1.7.2/lib/dry/types/array/member.rb:31:in `each_with_object'
    from C:/Users/alefi/.local/share/gem/ruby/3.2.0/gems/dry-types-1.7.2/lib/dry/types/array/member.rb:31:in `call_unsafe'
    from C:/Users/alefi/.local/share/gem/ruby/3.2.0/gems/dry-types-1.7.2/lib/dry/types/constrained.rb:35:in `call_unsafe'
    from C:/Users/alefi/.local/share/gem/ruby/3.2.0/gems/dry-types-1.7.2/lib/dry/types/schema/key.rb:46:in `call_unsafe'
    from C:/Users/alefi/.local/share/gem/ruby/3.2.0/gems/dry-types-1.7.2/lib/dry/types/schema.rb:330:in `block in resolve_unsafe'
    from C:/Users/alefi/.local/share/gem/ruby/3.2.0/gems/dry-types-1.7.2/lib/dry/types/schema.rb:324:in `each'
    from C:/Users/alefi/.local/share/gem/ruby/3.2.0/gems/dry-types-1.7.2/lib/dry/types/schema.rb:324:in `resolve_unsafe'
    from C:/Users/alefi/.local/share/gem/ruby/3.2.0/gems/dry-types-1.7.2/lib/dry/types/schema.rb:60:in `call_unsafe'
    from C:/Users/alefi/.local/share/gem/ruby/3.2.0/gems/dry-types-1.7.2/lib/dry/types/constructor.rb:81:in `call_unsafe'
    from C:/Users/alefi/.local/share/gem/ruby/3.2.0/gems/dry-struct-1.6.0/lib/dry/struct/class_interface.rb:264:in `new'
    from C:/Users/alefi/.local/share/gem/ruby/3.2.0/gems/dry-struct-1.6.0/lib/dry/struct/class_interface.rb:284:in `call_unsafe'
    from C:/Users/alefi/.local/share/gem/ruby/3.2.0/gems/dry-types-1.7.2/lib/dry/types/type.rb:47:in `call'
    from C:/Users/alefi/.local/share/gem/ruby/3.2.0/gems/telegram-bot-ruby-2.0.0/lib/telegram/bot/api.rb:34:in `method_missing'
    from c:/Users/alefi/Documents/twitter_to_images_telegram/modules/standart_messages.rb:114:in `response_to_images'
    from c:/Users/alefi/Documents/twitter_to_images_telegram/modules/standart_messages.rb:341:in `process'
    from c:/Users/alefi/Documents/twitter_to_images_telegram/modules/listener.rb:28:in `catch_new_message'
    from c:/Users/alefi/Documents/twitter_to_images_telegram/modules/threads.rb:90:in `block (2 levels) in main_bot'
C:/Users/alefi/.local/share/gem/ruby/3.2.0/gems/dry-types-1.7.2/lib/dry/types/schema.rb:332:in `rescue in block in resolve_unsafe': "paid" (String) has invalid type for :type violates constraints (eql?("custom_emoji", "paid") failed) (Dry::Types::SchemaError)
    from C:/Users/alefi/.local/share/gem/ruby/3.2.0/gems/dry-types-1.7.2/lib/dry/types/schema.rb:329:in `block in resolve_unsafe'
    from C:/Users/alefi/.local/share/gem/ruby/3.2.0/gems/dry-types-1.7.2/lib/dry/types/schema.rb:324:in `each'
    from C:/Users/alefi/.local/share/gem/ruby/3.2.0/gems/dry-types-1.7.2/lib/dry/types/schema.rb:324:in `resolve_unsafe'
    from C:/Users/alefi/.local/share/gem/ruby/3.2.0/gems/dry-types-1.7.2/lib/dry/types/schema.rb:60:in `call_unsafe'
    from C:/Users/alefi/.local/share/gem/ruby/3.2.0/gems/dry-types-1.7.2/lib/dry/types/constructor.rb:81:in `call_unsafe'
    from C:/Users/alefi/.local/share/gem/ruby/3.2.0/gems/dry-struct-1.6.0/lib/dry/struct/class_interface.rb:264:in `new'
    from C:/Users/alefi/.local/share/gem/ruby/3.2.0/gems/dry-struct-1.6.0/lib/dry/struct/class_interface.rb:284:in `call_unsafe'
    from C:/Users/alefi/.local/share/gem/ruby/3.2.0/gems/dry-types-1.7.2/lib/dry/types/sum.rb:28:in `block in call_unsafe'
    from C:/Users/alefi/.local/share/gem/ruby/3.2.0/gems/dry-struct-1.6.0/lib/dry/struct/class_interface.rb:262:in `block in new'
    from C:/Users/alefi/.local/share/gem/ruby/3.2.0/gems/dry-types-1.7.2/lib/dry/types/constructor.rb:74:in `block in call_safe'
    from C:/Users/alefi/.local/share/gem/ruby/3.2.0/gems/dry-types-1.7.2/lib/dry/types/schema.rb:69:in `block in call_safe'
    from C:/Users/alefi/.local/share/gem/ruby/3.2.0/gems/dry-types-1.7.2/lib/dry/types/constrained.rb:48:in `call_safe'
    from C:/Users/alefi/.local/share/gem/ruby/3.2.0/gems/dry-types-1.7.2/lib/dry/types/default.rb:114:in `call_safe'
    from C:/Users/alefi/.local/share/gem/ruby/3.2.0/gems/dry-types-1.7.2/lib/dry/types/schema/key.rb:41:in `call_safe'
    from C:/Users/alefi/.local/share/gem/ruby/3.2.0/gems/dry-types-1.7.2/lib/dry/types/schema.rb:359:in `block in resolve_safe'
    from C:/Users/alefi/.local/share/gem/ruby/3.2.0/gems/dry-types-1.7.2/lib/dry/types/schema.rb:354:in `each'
    from C:/Users/alefi/.local/share/gem/ruby/3.2.0/gems/dry-types-1.7.2/lib/dry/types/schema.rb:354:in `resolve_safe'
    from C:/Users/alefi/.local/share/gem/ruby/3.2.0/gems/dry-types-1.7.2/lib/dry/types/schema.rb:69:in `call_safe'
    from C:/Users/alefi/.local/share/gem/ruby/3.2.0/gems/dry-types-1.7.2/lib/dry/types/constructor.rb:74:in `call_safe'
    from C:/Users/alefi/.local/share/gem/ruby/3.2.0/gems/dry-struct-1.6.0/lib/dry/struct/class_interface.rb:262:in `new'
    from C:/Users/alefi/.local/share/gem/ruby/3.2.0/gems/dry-struct-1.6.0/lib/dry/struct/class_interface.rb:275:in `call_safe'
    from C:/Users/alefi/.local/share/gem/ruby/3.2.0/gems/dry-types-1.7.2/lib/dry/types/sum.rb:28:in `call_unsafe'
    from C:/Users/alefi/.local/share/gem/ruby/3.2.0/gems/dry-types-1.7.2/lib/dry/types/array/member.rb:32:in `block in call_unsafe'
    from C:/Users/alefi/.local/share/gem/ruby/3.2.0/gems/dry-types-1.7.2/lib/dry/types/array/member.rb:31:in `each'
    from C:/Users/alefi/.local/share/gem/ruby/3.2.0/gems/dry-types-1.7.2/lib/dry/types/array/member.rb:31:in `each_with_object'
    from C:/Users/alefi/.local/share/gem/ruby/3.2.0/gems/dry-types-1.7.2/lib/dry/types/array/member.rb:31:in `call_unsafe'
    from C:/Users/alefi/.local/share/gem/ruby/3.2.0/gems/dry-types-1.7.2/lib/dry/types/constrained.rb:35:in `call_unsafe'
    from C:/Users/alefi/.local/share/gem/ruby/3.2.0/gems/dry-types-1.7.2/lib/dry/types/schema/key.rb:46:in `call_unsafe'
    from C:/Users/alefi/.local/share/gem/ruby/3.2.0/gems/dry-types-1.7.2/lib/dry/types/schema.rb:330:in `block in resolve_unsafe'
    from C:/Users/alefi/.local/share/gem/ruby/3.2.0/gems/dry-types-1.7.2/lib/dry/types/schema.rb:324:in `each'
    from C:/Users/alefi/.local/share/gem/ruby/3.2.0/gems/dry-types-1.7.2/lib/dry/types/schema.rb:324:in `resolve_unsafe'
    from C:/Users/alefi/.local/share/gem/ruby/3.2.0/gems/dry-types-1.7.2/lib/dry/types/schema.rb:60:in `call_unsafe'
    from C:/Users/alefi/.local/share/gem/ruby/3.2.0/gems/dry-types-1.7.2/lib/dry/types/constructor.rb:81:in `call_unsafe'
    from C:/Users/alefi/.local/share/gem/ruby/3.2.0/gems/dry-struct-1.6.0/lib/dry/struct/class_interface.rb:264:in `new'
    from C:/Users/alefi/.local/share/gem/ruby/3.2.0/gems/dry-struct-1.6.0/lib/dry/struct/class_interface.rb:284:in `call_unsafe'
    from C:/Users/alefi/.local/share/gem/ruby/3.2.0/gems/dry-types-1.7.2/lib/dry/types/type.rb:47:in `call'
    from C:/Users/alefi/.local/share/gem/ruby/3.2.0/gems/telegram-bot-ruby-2.0.0/lib/telegram/bot/api.rb:34:in `method_missing'
    from c:/Users/alefi/Documents/twitter_to_images_telegram/modules/standart_messages.rb:114:in `response_to_images'
    from c:/Users/alefi/Documents/twitter_to_images_telegram/modules/standart_messages.rb:341:in `process'
    from c:/Users/alefi/Documents/twitter_to_images_telegram/modules/listener.rb:28:in `catch_new_message'
    from c:/Users/alefi/Documents/twitter_to_images_telegram/modules/threads.rb:90:in `block (2 levels) in main_bot'
C:/Users/alefi/.local/share/gem/ruby/3.2.0/gems/dry-types-1.7.2/lib/dry/types/constrained.rb:37:in `call_unsafe': "paid" violates constraints (eql?("custom_emoji", "paid") failed) (Dry::Types::ConstraintError)
    from C:/Users/alefi/.local/share/gem/ruby/3.2.0/gems/dry-types-1.7.2/lib/dry/types/default.rb:101:in `call_unsafe'
    from C:/Users/alefi/.local/share/gem/ruby/3.2.0/gems/dry-types-1.7.2/lib/dry/types/schema/key.rb:46:in `call_unsafe'
    from C:/Users/alefi/.local/share/gem/ruby/3.2.0/gems/dry-types-1.7.2/lib/dry/types/schema.rb:330:in `block in resolve_unsafe'
    from C:/Users/alefi/.local/share/gem/ruby/3.2.0/gems/dry-types-1.7.2/lib/dry/types/schema.rb:324:in `each'
    from C:/Users/alefi/.local/share/gem/ruby/3.2.0/gems/dry-types-1.7.2/lib/dry/types/schema.rb:324:in `resolve_unsafe'
    from C:/Users/alefi/.local/share/gem/ruby/3.2.0/gems/dry-types-1.7.2/lib/dry/types/schema.rb:60:in `call_unsafe'
    from C:/Users/alefi/.local/share/gem/ruby/3.2.0/gems/dry-types-1.7.2/lib/dry/types/constructor.rb:81:in `call_unsafe'
    from C:/Users/alefi/.local/share/gem/ruby/3.2.0/gems/dry-struct-1.6.0/lib/dry/struct/class_interface.rb:264:in `new'
    from C:/Users/alefi/.local/share/gem/ruby/3.2.0/gems/dry-struct-1.6.0/lib/dry/struct/class_interface.rb:284:in `call_unsafe'
    from C:/Users/alefi/.local/share/gem/ruby/3.2.0/gems/dry-types-1.7.2/lib/dry/types/sum.rb:28:in `block in call_unsafe'
    from C:/Users/alefi/.local/share/gem/ruby/3.2.0/gems/dry-struct-1.6.0/lib/dry/struct/class_interface.rb:262:in `block in new'
    from C:/Users/alefi/.local/share/gem/ruby/3.2.0/gems/dry-types-1.7.2/lib/dry/types/constructor.rb:74:in `block in call_safe'
    from C:/Users/alefi/.local/share/gem/ruby/3.2.0/gems/dry-types-1.7.2/lib/dry/types/schema.rb:69:in `block in call_safe'
    from C:/Users/alefi/.local/share/gem/ruby/3.2.0/gems/dry-types-1.7.2/lib/dry/types/constrained.rb:48:in `call_safe'
    from C:/Users/alefi/.local/share/gem/ruby/3.2.0/gems/dry-types-1.7.2/lib/dry/types/default.rb:114:in `call_safe'
    from C:/Users/alefi/.local/share/gem/ruby/3.2.0/gems/dry-types-1.7.2/lib/dry/types/schema/key.rb:41:in `call_safe'
    from C:/Users/alefi/.local/share/gem/ruby/3.2.0/gems/dry-types-1.7.2/lib/dry/types/schema.rb:359:in `block in resolve_safe'
    from C:/Users/alefi/.local/share/gem/ruby/3.2.0/gems/dry-types-1.7.2/lib/dry/types/schema.rb:354:in `each'
    from C:/Users/alefi/.local/share/gem/ruby/3.2.0/gems/dry-types-1.7.2/lib/dry/types/schema.rb:354:in `resolve_safe'
    from C:/Users/alefi/.local/share/gem/ruby/3.2.0/gems/dry-types-1.7.2/lib/dry/types/schema.rb:69:in `call_safe'
    from C:/Users/alefi/.local/share/gem/ruby/3.2.0/gems/dry-types-1.7.2/lib/dry/types/constructor.rb:74:in `call_safe'
    from C:/Users/alefi/.local/share/gem/ruby/3.2.0/gems/dry-struct-1.6.0/lib/dry/struct/class_interface.rb:262:in `new'
    from C:/Users/alefi/.local/share/gem/ruby/3.2.0/gems/dry-struct-1.6.0/lib/dry/struct/class_interface.rb:275:in `call_safe'
    from C:/Users/alefi/.local/share/gem/ruby/3.2.0/gems/dry-types-1.7.2/lib/dry/types/sum.rb:28:in `call_unsafe'
    from C:/Users/alefi/.local/share/gem/ruby/3.2.0/gems/dry-types-1.7.2/lib/dry/types/array/member.rb:32:in `block in call_unsafe'
    from C:/Users/alefi/.local/share/gem/ruby/3.2.0/gems/dry-types-1.7.2/lib/dry/types/array/member.rb:31:in `each'
    from C:/Users/alefi/.local/share/gem/ruby/3.2.0/gems/dry-types-1.7.2/lib/dry/types/array/member.rb:31:in `each_with_object'
    from C:/Users/alefi/.local/share/gem/ruby/3.2.0/gems/dry-types-1.7.2/lib/dry/types/array/member.rb:31:in `call_unsafe'
    from C:/Users/alefi/.local/share/gem/ruby/3.2.0/gems/dry-types-1.7.2/lib/dry/types/constrained.rb:35:in `call_unsafe'
    from C:/Users/alefi/.local/share/gem/ruby/3.2.0/gems/dry-types-1.7.2/lib/dry/types/schema/key.rb:46:in `call_unsafe'
    from C:/Users/alefi/.local/share/gem/ruby/3.2.0/gems/dry-types-1.7.2/lib/dry/types/schema.rb:330:in `block in resolve_unsafe'
    from C:/Users/alefi/.local/share/gem/ruby/3.2.0/gems/dry-types-1.7.2/lib/dry/types/schema.rb:324:in `each'
    from C:/Users/alefi/.local/share/gem/ruby/3.2.0/gems/dry-types-1.7.2/lib/dry/types/schema.rb:324:in `resolve_unsafe'
    from C:/Users/alefi/.local/share/gem/ruby/3.2.0/gems/dry-types-1.7.2/lib/dry/types/schema.rb:60:in `call_unsafe'
    from C:/Users/alefi/.local/share/gem/ruby/3.2.0/gems/dry-types-1.7.2/lib/dry/types/constructor.rb:81:in `call_unsafe'
    from C:/Users/alefi/.local/share/gem/ruby/3.2.0/gems/dry-struct-1.6.0/lib/dry/struct/class_interface.rb:264:in `new'
    from C:/Users/alefi/.local/share/gem/ruby/3.2.0/gems/dry-struct-1.6.0/lib/dry/struct/class_interface.rb:284:in `call_unsafe'
    from C:/Users/alefi/.local/share/gem/ruby/3.2.0/gems/dry-types-1.7.2/lib/dry/types/type.rb:47:in `call'
    from C:/Users/alefi/.local/share/gem/ruby/3.2.0/gems/telegram-bot-ruby-2.0.0/lib/telegram/bot/api.rb:34:in `method_missing'
    from c:/Users/alefi/Documents/twitter_to_images_telegram/modules/standart_messages.rb:114:in `response_to_images'
    from c:/Users/alefi/Documents/twitter_to_images_telegram/modules/standart_messages.rb:341:in `process'
    from c:/Users/alefi/Documents/twitter_to_images_telegram/modules/listener.rb:28:in `catch_new_message'
    from c:/Users/alefi/Documents/twitter_to_images_telegram/modules/threads.rb:90:in `block (2 levels) in main_bot'
seorgiy commented 1 month ago

ReactionTypePaid was introduced in 7.9. You may try to use my fork if it is still relevant for you