-
-
Notifications
You must be signed in to change notification settings - Fork 27
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
bug: empty username picked when first name and last name have more than 10 chars #50
Comments
@nekomeowww Is this fix related to insights-bot/pkg/bots/tgbot/utils.go Line 64 in 53ddb31
In addition, would you mind to provide an example of input (i.e. the first name and last name with >10 chars) related to this case? Lastly, what are the expectation? Trimming the output? Thanks! |
Hey, welcome to this repo and contribute!
I checked the source code and find out I miss stated the package that needs to be fixed. The correct one should be:
The related edge cases should be the following: Case OneOver 10 chars of {
"first_name": "blah blah | SomeSubName :> | 😄",
"last_name": "",
"username": ""
} Case TwoOver 10 chars of {
"first_name": "blah blah | SomeSubName :> | 😄",
"last_name": "",
"username": "example_username"
} This function is used to match the very long name I have seen in Telegram initially, some of the people would use the
The answer to this question is: probably yes? You might have to come up a idea about how to trim the very long first name in case 1 while still covering case 2. |
@nekomeowww what if full name (first name + last name) is over 10 chars and username is longer than full name? something like:
are we still returning the username?
because it looks like you prefer to return shorter string here |
Yes, it is better to have the less one. Therefore it is not strictly to say we have to return username or fullname, it is ok to return the shorter one directly. If the returned one is still to long (such as 20 runes), we might have to trim the string off. |
OK. I think it is clear enough. |
@nekomeowww Would it be OK if we remove spaces from the fullname?
|
If you are talking about the space between first name and last name, |
@nekomeowww Sounds good to me. We can implement it that way. |
fix
pkg/tgbot/utils.go
The text was updated successfully, but these errors were encountered: