Skip to content

Commit

Permalink
merge
Browse files Browse the repository at this point in the history
  • Loading branch information
nerzh committed Jan 17, 2024
2 parents 3172561 + 333e06f commit d97d159
Showing 1 changed file with 37 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
// Telegram-vapor-bot - Telegram Bot Swift SDK.

/**
This extension adds common properties betwwen TGMessage and TGInaccessibleMessage (chat, messageId and date) to TGMaybeInaccessibleMessage. These properties are always accessible no mather TGInaccessibleMessage is TGMessage or TGInaccessibleMessage.
SeeAlso Telegram Bot API Reference:
[MaybeInaccessibleMessage](https://core.telegram.org/bots/api#maybeinaccessiblemessage)
**/

public extension TGMaybeInaccessibleMessage {
var chat: TGChat {
switch self {
case .inaccessibleMessage(let msg):
return msg.chat
case .message(let msg):
return msg.chat
}
}

var messageId: Int {
switch self {
case .inaccessibleMessage(let msg):
return msg.messageId
case .message(let msg):
return msg.messageId
}
}

var date: Int {
switch self {
case .inaccessibleMessage(let msg):
return msg.date
case .message(let msg):
return msg.date
}
}
}

0 comments on commit d97d159

Please sign in to comment.