Added url Filter#565
Conversation
|
Hmm, why not just adding a filter that filters messages based on an user-specified entity? Such as python-telegram-bot's |
|
Yeah that can be done as well and that would be better but as everything else like common entities are present in filters directly and urls are used by alot of programmers so just thought why not make a common filter for urls. The method you said looks clean will try to impliment that till then this can be considered as a quick fix for all those who want to skip those nested if else's for checking if a url is present in their text or not. |
|
Uhm, I think quick fixes be part of the user's code instead of being embedded directly in the library |
|
Yeah that's true will close this Pull Request. |
|
Hi @logicfool, Your implementation of a URL filter looks quite messy in my opinion. The other filters we have in Pyrogram aren't quite for MessageEntities, but for attributes already easily accessible. These are convenient for the user as they don't have to do long if-chains anymore. A URL filter for the MessageEntity isn't really beneficial, as a User still has to check the individual Entities to check whether or not the URL is correct or expected. It would be a lot easier to use a basic URL RegEx (I made this in about a minute). @ChenZehong13 From your commit history in your own repositories and your stars I take you don't work with Python or Pyrogram often or at all. Why do you leave Reviews and comments that contribute literally nothing to the PR at hand? That's a rhetorical question |
|
Ah yes I understand better not put it in the main library.. |
Url filter
It would be easier for people working with urls to use this filter and check if that message has a url or not so they wont have to go all the way through entities and check the type and then use if else
right now I just used entities to go through all of them but will read the whole pyrogram code and modify this later on to make it better then it is right now