Skip to content

Commit

Permalink
CopyMessage returns MessageId, fixes #410 (#411)
Browse files Browse the repository at this point in the history
  • Loading branch information
OlegYch authored Jul 17, 2024
1 parent 128b0c0 commit 9f0fe35
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,7 @@ trait CirceDecoders extends StrictLogging {
implicit val stickerDecoder: Decoder[Sticker] = deriveDecoder[Sticker]

implicit val messageDecoder: Decoder[Message] = deriveDecoder[Message]
implicit val messageIdDecoder: Decoder[MessageId] = deriveDecoder[MessageId]
implicit val callbackQueryDecoder: Decoder[CallbackQuery] = deriveDecoder[CallbackQuery]

implicit val stickerSetDecoder: Decoder[StickerSet] = deriveDecoder[StickerSet]
Expand Down
3 changes: 2 additions & 1 deletion core/src/com/bot4s/telegram/marshalling/CirceEncoders.scala
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,8 @@ trait CirceEncoders {
implicit val animationEncoder: Encoder[Animation] = deriveConfiguredEncoder[Animation]
implicit val gameEncoder: Encoder[Game] = deriveConfiguredEncoder[Game]

implicit val messageEncoder: Encoder[Message] = deriveConfiguredEncoder[Message]
implicit val messageEncoder: Encoder[Message] = deriveConfiguredEncoder[Message]
implicit val messageIdEncoder: Encoder[MessageId] = deriveConfiguredEncoder[MessageId]

implicit val messageEntityTypeEncoder: Encoder[MessageEntityType] =
Encoder[String].contramap[MessageEntityType](e => CaseConversions.snakenize(e.toString))
Expand Down
4 changes: 2 additions & 2 deletions core/src/com/bot4s/telegram/methods/CopyMessage.scala
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.bot4s.telegram.methods

import ParseMode.ParseMode
import com.bot4s.telegram.models.{ ChatId, Message, MessageEntity, ReplyMarkup }
import com.bot4s.telegram.models.{ ChatId, MessageEntity, MessageId, ReplyMarkup }

/**
* Use this method to copy messages of any kind.
Expand Down Expand Up @@ -39,4 +39,4 @@ case class CopyMessage(
allowSendingWithoutReply: Option[Boolean] = None,
replyMarkup: Option[ReplyMarkup] = None,
messageThreadId: Option[Int] = None
) extends JsonRequest[Message]
) extends JsonRequest[MessageId]
10 changes: 10 additions & 0 deletions core/src/com/bot4s/telegram/models/MessageId.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package com.bot4s.telegram.models

/**
* This object represents a unique message identifier.
*
* @param messageId Unique message identifier
*/
case class MessageId(
messageId: Int
)

0 comments on commit 9f0fe35

Please sign in to comment.