diff --git a/lib/src/teledart/event/event.dart b/lib/src/teledart/event/event.dart index 001e5b0..8d45909 100644 --- a/lib/src/teledart/event/event.dart +++ b/lib/src/teledart/event/event.dart @@ -33,9 +33,10 @@ class Event { final StreamController _editedMessageStreamController; final StreamController _channelPostStreamController; final StreamController _editedChannelPostStreamController; + final StreamController _messageReactionStreamController; + final StreamController _messageReactionCountStreamController; final StreamController _inlineQueryStreamController; - final StreamController - _chosenInlineResultStreamController; + final StreamController _chosenInlineResultStreamController; final StreamController _callbackQueryStreamController; final StreamController _shippingQueryStreamController; final StreamController _preCheckoutQueryStreamController; @@ -51,6 +52,8 @@ class Event { _channelPostStreamController = StreamController.broadcast(sync: sync), _editedChannelPostStreamController = StreamController.broadcast(sync: sync), + _messageReactionStreamController = StreamController.broadcast(sync: sync), + _messageReactionCountStreamController = StreamController.broadcast(sync: sync), _inlineQueryStreamController = StreamController.broadcast(sync: sync), _chosenInlineResultStreamController = StreamController.broadcast(sync: sync), @@ -75,6 +78,10 @@ class Event { _channelPostStreamController.add(update.channelPost!); } else if (update.editedChannelPost != null) { _editedChannelPostStreamController.add(update.editedChannelPost!); + } else if (update.messageReaction != null) { + _messageReactionStreamController.add(update.messageReaction!); + } else if (update.messageReactionCount != null) { + _messageReactionCountStreamController.add(update.messageReactionCount!); } else if (update.inlineQuery != null) { _inlineQueryStreamController.add(update.inlineQuery!); } else if (update.chosenInlineResult != null) { @@ -196,6 +203,14 @@ class Event { Stream onEditedChannelPost() => _editedChannelPostStreamController.stream; + /// Listens to message reaction updated events + Stream onMessageReactionUpdated() => + _messageReactionStreamController.stream; + + /// Listens to message reaction count updated events + Stream onMessageReactionCountUpdated() => + _messageReactionCountStreamController.stream; + /// Listens to inline query events Stream onInlineQuery() => _inlineQueryStreamController.stream; diff --git a/lib/src/teledart/fetch/long_polling.dart b/lib/src/teledart/fetch/long_polling.dart index 000eead..672dcf0 100644 --- a/lib/src/teledart/fetch/long_polling.dart +++ b/lib/src/teledart/fetch/long_polling.dart @@ -44,6 +44,10 @@ class LongPolling extends AbstractUpdateFetcher { Duration retryDelay = Duration(seconds: 5); /// Setup long polling + /// + /// Setting [allowedUpdates] to empty **List** to receive all update types + /// except **chat_member**, **message_reaction**, and **message_reaction_count** + /// If not specified, the previous setting will be used. /// /// Throws [LongPollingException] if [limit] is less than 1 or greater than 100 /// or [timeout] is greater than 50. diff --git a/lib/src/teledart/fetch/webhook.dart b/lib/src/teledart/fetch/webhook.dart index 2a6ca8a..e546601 100644 --- a/lib/src/teledart/fetch/webhook.dart +++ b/lib/src/teledart/fetch/webhook.dart @@ -54,6 +54,10 @@ class Webhook extends AbstractUpdateFetcher { /// /// Default [port] is `443`, Telegram API supports `443`, `80`, `88`, `8443`. /// Provide [privateKey] and [certificate] pair for HTTPS configuration + /// + /// Setting [allowedUpdates] to empty **List** to receive all update types + /// except **chat_member**, **message_reaction**, and **message_reaction_count** + /// If not specified, the previous setting will be used. /// /// Throws [WebhookException] if [port] is not supported by Telegram /// or [maxConnections] is less than 1 or greater than 100. diff --git a/lib/src/teledart/model/message.dart b/lib/src/teledart/model/message.dart index ac5f641..f7deb11 100644 --- a/lib/src/teledart/model/message.dart +++ b/lib/src/teledart/model/message.dart @@ -756,7 +756,7 @@ class TeleDartMessage extends Message { /// change the chosen reactions on a message /// /// A wrapper around [TeleDart.setMessageReaction]. - /// On success, returns the sent *True*. + /// On success, returns the sent **True**. /// /// It takes some optional parameters to customise the reaction /// diff --git a/lib/src/teledart/teledart.dart b/lib/src/teledart/teledart.dart index fa85937..5e8c2f2 100644 --- a/lib/src/teledart/teledart.dart +++ b/lib/src/teledart/teledart.dart @@ -155,6 +155,14 @@ class TeleDart extends Telegram { /// Listen to edited channel post events Stream onEditedChannelPost() => _event.onEditedChannelPost().map(_messageStreamMapper); + + /// Listen to edited reaction updated events + Stream onMessageReactionUpdated() => + _event.onMessageReactionUpdated(); + + /// Listen to edited reaction count updated events + Stream onMessageReactionCountUpdated() => + _event.onMessageReactionCountUpdated(); /// Listen to inline query events /// diff --git a/lib/src/telegram/telegram.dart b/lib/src/telegram/telegram.dart index ffd058c..cfd002c 100644 --- a/lib/src/telegram/telegram.dart +++ b/lib/src/telegram/telegram.dart @@ -1111,7 +1111,7 @@ class Telegram { /// Use this method to change the chosen reactions on a message. Service messages can't be reacted to. /// Automatically forwarded messages from a channel to its discussion group have the same available reactions as messages in the channel. /// - /// Returns *True* on success. + /// Returns **True** on success. /// /// https://core.telegram.org/bots/api#setmessagereaction Future setMessageReaction(dynamic chatId, int messageId,