diff --git a/botx/bots/mixins/requests/command.py b/botx/bots/mixins/requests/command.py index 3f28cc12..391fd9eb 100644 --- a/botx/bots/mixins/requests/command.py +++ b/botx/bots/mixins/requests/command.py @@ -43,7 +43,7 @@ async def send_command_result( silent_response=payload.options.silent_response, ), ), - recipients=payload.options.recipients, + recipients=payload.options.recipients or "all", file=payload.file, opts=ResultOptions( stealth_mode=payload.options.stealth_mode, diff --git a/botx/bots/mixins/requests/notification.py b/botx/bots/mixins/requests/notification.py index a4dfe1e9..e4fee4b9 100644 --- a/botx/bots/mixins/requests/notification.py +++ b/botx/bots/mixins/requests/notification.py @@ -50,7 +50,7 @@ async def send_notification( silent_response=payload.options.silent_response, ), ), - recipients=payload.options.recipients, + recipients=payload.options.recipients or "all", file=payload.file, opts=ResultOptions( stealth_mode=payload.options.stealth_mode, diff --git a/botx/clients/methods/v3/notification/direct_notification.py b/botx/clients/methods/v3/notification/direct_notification.py index 3fbaca7f..79f85f67 100644 --- a/botx/clients/methods/v3/notification/direct_notification.py +++ b/botx/clients/methods/v3/notification/direct_notification.py @@ -28,8 +28,7 @@ class NotificationDirect(AuthorizedBotXMethod[UUID]): event_sync_id: Optional[UUID] = None #: HUIDs of users that should receive notifications. - recipients: AvailableRecipients = "all" - + recipients: Optional[AvailableRecipients] = None #: data for build message: body, markup, mentions. result: ResultPayload = Field(..., alias="notification") diff --git a/botx/models/messages/sending/message.py b/botx/models/messages/sending/message.py index 6b8aa470..d645ba55 100644 --- a/botx/models/messages/sending/message.py +++ b/botx/models/messages/sending/message.py @@ -438,7 +438,7 @@ def add_recipient(self, recipient: UUID) -> None: Arguments: recipient: recipient for message. """ - if self.payload.options.recipients == "all": + if not isinstance(self.payload.options.recipients, list): self.payload.options.recipients = [] self.payload.options.recipients.append(recipient) @@ -449,7 +449,7 @@ def add_recipients(self, recipients: List[UUID]) -> None: Arguments: recipients: recipients for message. """ - if self.payload.options.recipients == "all": + if not isinstance(self.payload.options.recipients, list): self.payload.options.recipients = [] self.payload.options.recipients.extend(recipients) diff --git a/botx/models/messages/sending/options.py b/botx/models/messages/sending/options.py index 962d7e62..01e7029c 100644 --- a/botx/models/messages/sending/options.py +++ b/botx/models/messages/sending/options.py @@ -1,6 +1,6 @@ """Special options for message.""" -from typing import List +from typing import List, Optional from botx.models.base import BotXBaseModel from botx.models.entities import Mention @@ -28,7 +28,7 @@ class MessageOptions(BotXBaseModel): """Message options configuration.""" #: users that should receive message. - recipients: AvailableRecipients = "all" + recipients: Optional[AvailableRecipients] = None #: attached to message mentions. mentions: List[Mention] = []