Skip to content

Commit fcc7809

Browse files
committed
Show warnings when messages are not compatible with as_copy
2 parents a18e024 + 35ec328 commit fcc7809

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

pyrogram/types/messages_and_media/message.py

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
# You should have received a copy of the GNU Lesser General Public License
1717
# along with Pyrogram. If not, see <http://www.gnu.org/licenses/>.
1818

19+
import logging
1920
from functools import partial
2021
from typing import List, Match, Union, BinaryIO
2122

@@ -28,6 +29,8 @@
2829
from ..object import Object
2930
from ..update import Update
3031

32+
log = logging.getLogger(__name__)
33+
3134

3235
class Str(str):
3336
def __init__(self, *args):
@@ -2706,12 +2709,12 @@ async def forward(
27062709
"""
27072710
if as_copy:
27082711
if self.service:
2709-
raise ValueError("Unable to copy service messages")
2710-
2711-
if self.game and not await self._client.storage.is_bot():
2712-
raise ValueError("Users cannot send messages with Game media type")
2713-
2714-
if self.text:
2712+
log.warning(f"Service messages cannot be copied. "
2713+
f"chat_id: {self.chat.id}, message_id: {self.message_id}")
2714+
elif self.game and not await self._client.storage.is_bot():
2715+
log.warning(f"Users cannot send messages with Game media type. "
2716+
f"chat_id: {self.chat.id}, message_id: {self.message_id}")
2717+
elif self.text:
27152718
return await self._client.send_message(
27162719
chat_id,
27172720
text=self.text.html,

0 commit comments

Comments
 (0)