go-telegram / bot

Telegram Bot API Go framework
MIT License
502 stars 46 forks source link

SetMessageReaction not working #59

Closed crossworth closed 4 months ago

crossworth commented 5 months ago

Hello, I'm testing your library, great work.

One thing that I'm having trouble with is SetMessageReaction, I get errors when using it.

I'm able to make it work by defining a custom MarshalJSON like so:

func (rt *ReactionType) MarshalJSON() ([]byte, error) {
    if rt.Type == ReactionTypeTypeEmoji {
        return json.Marshal(rt.ReactionTypeEmoji)
    }
    if rt.Type == ReactionTypeTypeCustomEmoji {
        return json.Marshal(rt.ReactionTypeCustomEmoji)
    }
    return nil, fmt.Errorf("unsupported ReactionType type")
}

This creates the reaction but returns one error:

error decode response result for method setMessageReaction, json: Unmarshal(non-pointer bool)

I'm not sure why.

negasus commented 4 months ago

Fixed in v1.1.2