Skip to content

Commit

Permalink
Merge pull request #94 from cipi1965/new-router-contenttype
Browse files Browse the repository at this point in the history
Add new routing types for edited_message
  • Loading branch information
cipi1965 authored Feb 14, 2020
2 parents 1f8e81c + 3758a05 commit 9f8cfea
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 0 deletions.
19 changes: 19 additions & 0 deletions Sources/TelegramBotSDK/Router/ContentType.swift
Original file line number Diff line number Diff line change
Expand Up @@ -45,4 +45,23 @@ public enum ContentType {
case migrateFromChatId
case pinnedMessage
case callback_query(data: String?)

case editedFrom
case editedForwardFrom
case editedForwardFromChat
case editedForwardDate
case editedReplyToMessage
case editedEditDate
case editedText
case editedEntities
case editedAudio
case editedDocument
case editedPhoto
case editedSticker
case editedVideo
case editedVoice
case editedCaption
case editedContact
case editedLocation
case editedVenue
}
22 changes: 22 additions & 0 deletions Sources/TelegramBotSDK/Router/Router.swift
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,28 @@ public class Router {
case .pinnedMessage: return message.pinnedMessage != nil
default: break
}
} else if let message = update.editedMessage {
switch contentType {
case .editedFrom: return message.from != nil
case .editedForwardFrom: return message.forwardFrom != nil
case .editedForwardFromChat: return message.forwardFromChat != nil
case .editedForwardDate: return message.forwardDate != nil
case .editedReplyToMessage: return message.replyToMessage != nil
case .editedEditDate: return message.editDate != nil
case .editedText: return message.text != nil
case .editedEntities: return !message.entities.isEmpty
case .editedAudio: return message.audio != nil
case .editedDocument: return message.document != nil
case .editedPhoto: return !message.photo.isEmpty
case .editedSticker: return message.sticker != nil
case .editedVideo: return message.video != nil
case .editedVoice: return message.voice != nil
case .editedCaption: return message.caption != nil
case .editedContact: return message.contact != nil
case .editedLocation: return message.location != nil
case .editedVenue: return message.venue != nil
default: break
}
} else {
switch contentType {
case .callback_query(let data):
Expand Down

0 comments on commit 9f8cfea

Please sign in to comment.