79344083

Date: 2025-01-09 21:33:22
Score: 0.5
Natty:
Report link

How to find the user depends on how you are getting the username in the first place.

For example, if you are doing it based on a message the banned user sent, Message.from_user exposes the User object of the sender, giving you access to the user id.

Alternatively, if you have a command like /ban @username with the user tagged, the Message.entities returns you a list of MessageEntitys, which you can iterate through to find the tagged user's entity. See the documentation for Message.entities and MessageEntity.

Reasons:
  • Has code block (-0.5):
  • Starts with a question (0.5): How to find the use
  • Low reputation (0.5):
Posted by: ilgazer