telegram-bot-ruby icon indicating copy to clipboard operation
telegram-bot-ruby copied to clipboard

Fixed to_compact_hash not working on Chat and Array object

Open araishikeiwai opened this issue 6 years ago • 0 comments

For an object message of type Telegram::Bot::Types::Message, if you call

message.to_compact_hash

The chat and entities attribute don't get converted to a hash.

I fixed it by making Chat class inherit Base (because the condition on calling to_compact_hash in the method is only checking whether the class inherits Base or not). Another alternative is by adding additional inherited class in the condition (Telegram::Bot::Types::Compactable)

Also, arrays of compactables don't get converted properly, I setup recursive method to convert arrays too.

araishikeiwai avatar May 07 '18 07:05 araishikeiwai