mirror of
https://github.com/python-telegram-bot/python-telegram-bot.git
synced 2024-11-21 22:56:38 +01:00
Updated Code snippets (markdown)
parent
2eca2c407e
commit
da23079626
1 changed files with 6 additions and 8 deletions
|
@ -483,18 +483,16 @@ dispatcher.add_handler(add_group_handle)
|
|||
```
|
||||
|
||||
#### Exclude forwarded channel posts in discussion groups from MessageHandlers
|
||||
If you're using MessageHandlers and do not want them to respond to the channel posts automatically forwarded to the discussion group linked to your channel, you can use this filter in your MessageHandler:
|
||||
If you're using `MessageHandlers` and do not want them to respond to the channel posts automatically forwarded to the discussion group linked to your channel, you can use this filter in your `MessageHandler`:
|
||||
```python
|
||||
~ Filters.user(777000)
|
||||
```
|
||||
`777000` is the user id of the Telegram Service Messages chat, that also gives you your login codes and in this case will be the originator of the forwarded channel post.
|
||||
~ Filters.sender_chat.channel
|
||||
```
|
||||
|
||||
#### Exclude Messages from anonymous Admins
|
||||
If you're using MessageHandlers and do not want them to respond to messages from anonymous admins, you can use this filter in your MessageHandler:
|
||||
If you're using `MessageHandlers` and do not want them to respond to messages from anonymous admins, you can use this filter in your `MessageHandler`:
|
||||
```python
|
||||
~ Filters.user(1087968824)
|
||||
```
|
||||
`1087968824` is the user id of the @GroupAnonymousBot that will be the sender of those messages.
|
||||
~ Filters.sender_chat.super_group
|
||||
```
|
||||
|
||||
## Advanced snippets
|
||||
|
||||
|
|
Loading…
Reference in a new issue