TeleDart icon indicating copy to clipboard operation
TeleDart copied to clipboard

`chat_id` need to accept type of int and string

Open DinoLeung opened this issue 5 years ago • 5 comments

Describe the bug

Currently it only accept id(int), however according to the official docs, it needs to accept username(string) also

Unique identifier for the target chat or username of the target channel (in the format `@channelusername`)

https://github.com/dart-lang/sdk/issues/4938

DinoLeung avatar Apr 27 '19 07:04 DinoLeung

Any likelyhood of applying the patch?

castaway avatar Jul 28 '20 21:07 castaway

@castaway I'm opposed to use dynamic in the library, as it beat the purpose of having it statically typed. I have been looking into sealed_unions which does union type, still not decided to use it or not.

DinoLeung avatar Jul 29 '20 10:07 DinoLeung

Fair enough, could always make a sendChatMessage, sendUserMessage ? Or always take a string, and convert to int when sending if it parses as one?

castaway avatar Jul 30 '20 17:07 castaway

@castaway changing function parameters type would be considered a breaking change, which means it would break all existing bots depends on this library.

Although adding seperated implementation for each send message function would fix the issue we face, it also add unnecessary complexity to the project.

It is indeed a tough decision to make.

DinoLeung avatar Jul 31 '20 13:07 DinoLeung

#99 has a better idea

DinoLeung avatar Aug 20 '20 13:08 DinoLeung