mirror of
https://github.com/pyrogram/pyrogram
synced 2025-09-05 08:45:13 +00:00
Add a way to continue the update propagation within a group
Add continue_propagation() method and ContinuePropagation exception Closes #212
This commit is contained in:
@@ -32,7 +32,8 @@ from .client.types import (
|
||||
Location, Message, MessageEntity, Dialog, Dialogs, Photo, PhotoSize, Sticker, User, UserStatus,
|
||||
UserProfilePhotos, Venue, Animation, Video, VideoNote, Voice, CallbackQuery, Messages, ForceReply,
|
||||
InlineKeyboardButton, InlineKeyboardMarkup, KeyboardButton, ReplyKeyboardMarkup, ReplyKeyboardRemove,
|
||||
Poll, PollOption, ChatPreview, StopPropagation, Game, CallbackGame, GameHighScore, GameHighScores
|
||||
Poll, PollOption, ChatPreview, StopPropagation, ContinuePropagation, Game, CallbackGame, GameHighScore,
|
||||
GameHighScores
|
||||
)
|
||||
from .client import (
|
||||
Client, ChatAction, ParseMode, Emoji,
|
||||
|
@@ -151,6 +151,8 @@ class Dispatcher:
|
||||
handler.callback(self.client, *args)
|
||||
except pyrogram.StopPropagation:
|
||||
raise
|
||||
except pyrogram.ContinuePropagation:
|
||||
continue
|
||||
except Exception as e:
|
||||
log.error(e, exc_info=True)
|
||||
|
||||
|
@@ -30,7 +30,7 @@ from .messages_and_media import (
|
||||
Sticker, Venue, Video, VideoNote, Voice, UserProfilePhotos,
|
||||
Message, Messages, MessageEntity, Poll, PollOption, Game
|
||||
)
|
||||
from .update import StopPropagation
|
||||
from .update import StopPropagation, ContinuePropagation
|
||||
from .user_and_chats import (
|
||||
Chat, ChatMember, ChatMembers, ChatPhoto,
|
||||
Dialog, Dialogs, User, UserStatus, ChatPreview
|
||||
|
@@ -21,6 +21,13 @@ class StopPropagation(StopIteration):
|
||||
pass
|
||||
|
||||
|
||||
class ContinuePropagation(StopIteration):
|
||||
pass
|
||||
|
||||
|
||||
class Update:
|
||||
def stop_propagation(self):
|
||||
raise StopPropagation
|
||||
|
||||
def continue_propagation(self):
|
||||
raise ContinuePropagation
|
||||
|
Reference in New Issue
Block a user