Skip to content

Commit

Permalink
Fixed method :code:Message.send_copy for stickers (#1284)
Browse files Browse the repository at this point in the history
  • Loading branch information
JrooTJunior committed Aug 26, 2023
1 parent ca4c1b4 commit 397f30b
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 6 deletions.
1 change: 1 addition & 0 deletions CHANGES/1284.bugfix.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fixed method :code:`Message.send_copy` for stickers.
29 changes: 23 additions & 6 deletions aiogram/types/message.py
Original file line number Diff line number Diff line change
Expand Up @@ -2864,7 +2864,11 @@ def send_copy( # noqa: C901
}

if self.text:
return SendMessage(text=self.text, entities=self.entities, **kwargs).as_(self._bot)
return SendMessage(
text=self.text,
entities=self.entities,
**kwargs,
).as_(self._bot)
if self.audio:
return SendAudio(
audio=self.audio.file_id,
Expand Down Expand Up @@ -2897,7 +2901,10 @@ def send_copy( # noqa: C901
**kwargs,
).as_(self._bot)
if self.sticker:
return SendSticker(sticker=self.sticker.file_id, **kwargs)
return SendSticker(
sticker=self.sticker.file_id,
**kwargs,
).as_(self._bot)
if self.video:
return SendVideo(
video=self.video.file_id,
Expand All @@ -2906,9 +2913,15 @@ def send_copy( # noqa: C901
**kwargs,
).as_(self._bot)
if self.video_note:
return SendVideoNote(video_note=self.video_note.file_id, **kwargs).as_(self._bot)
return SendVideoNote(
video_note=self.video_note.file_id,
**kwargs,
).as_(self._bot)
if self.voice:
return SendVoice(voice=self.voice.file_id, **kwargs).as_(self._bot)
return SendVoice(
voice=self.voice.file_id,
**kwargs,
).as_(self._bot)
if self.contact:
return SendContact(
phone_number=self.contact.phone_number,
Expand All @@ -2929,7 +2942,9 @@ def send_copy( # noqa: C901
).as_(self._bot)
if self.location:
return SendLocation(
latitude=self.location.latitude, longitude=self.location.longitude, **kwargs
latitude=self.location.latitude,
longitude=self.location.longitude,
**kwargs,
).as_(self._bot)
if self.poll:
return SendPoll(
Expand All @@ -2938,7 +2953,9 @@ def send_copy( # noqa: C901
**kwargs,
).as_(self._bot)
if self.dice: # Dice value can't be controlled
return SendDice(**kwargs).as_(self._bot)
return SendDice(
**kwargs,
).as_(self._bot)

raise TypeError("This type of message can't be copied.")

Expand Down

0 comments on commit 397f30b

Please sign in to comment.