Skip to content
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

Support to allow admin and user by username, not just ID #130

Closed
PeterDaveHello opened this issue Mar 28, 2023 · 3 comments
Closed

Support to allow admin and user by username, not just ID #130

PeterDaveHello opened this issue Mar 28, 2023 · 3 comments

Comments

@PeterDaveHello
Copy link
Contributor

It's easier to retrieve and maintain username in the list, ID is not 😅

@n3d1117
Copy link
Owner

n3d1117 commented Mar 28, 2023

I might be wrong (maybe @AlexHTW can help me here), but if we use usernames then we have no way of checking if a user is a member of a group (this logic is used to calculate budget in group chats)

@AlexHTW
Copy link
Contributor

AlexHTW commented Mar 28, 2023

Hey @PeterDaveHello,
I understand your issue with the IDs, however I think it it is not safe to use usernames as identifiers. For one, a user can use legacy user names without the "@" which can be anything and not unique. Secondly, usernames can be changed, your user would lose access.
I think your issues can be helped by adding the user ID to the log outputs. That way you would always be aware about the ID connected to a username.
To add a new user they could send a message to the bot and you would see their ID in the log and can copy paste it. I made a PR #134, adding the user ID to every log output (@n3d1117 we can also limit it to only some of them, but I don't think it hurts everywhere).

Additionally, I recommend you add a comment line in your .env above/below the ALLOWED_TELEGRAM_USER_IDS with a list of the according username. For example:

# usernames: peter, jack, mary, chris
ALLOWED_TELEGRAM_USER_IDS="12334,345353,2342123,234234"

@n3d1117
Copy link
Owner

n3d1117 commented Apr 1, 2023

Closing this as using usernames doesn't seem feasible. For further improvements see #108

@n3d1117 n3d1117 closed this as completed Apr 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants