diff --git a/Sources/telegram-vapor-bot-lib/Bot/Filters/AllFilter.swift b/Sources/telegram-vapor-bot-lib/Bot/Filters/AllFilter.swift index 89aad53..cc9adc7 100644 --- a/Sources/telegram-vapor-bot-lib/Bot/Filters/AllFilter.swift +++ b/Sources/telegram-vapor-bot-lib/Bot/Filters/AllFilter.swift @@ -17,5 +17,5 @@ public class AllFilter: TGFilter { } public extension TGFilter { - static var all = AllFilter() + static var all: AllFilter { AllFilter() } } diff --git a/Sources/telegram-vapor-bot-lib/Bot/Filters/AudioFilter.swift b/Sources/telegram-vapor-bot-lib/Bot/Filters/AudioFilter.swift index 4f702c6..4bcd4f4 100644 --- a/Sources/telegram-vapor-bot-lib/Bot/Filters/AudioFilter.swift +++ b/Sources/telegram-vapor-bot-lib/Bot/Filters/AudioFilter.swift @@ -17,5 +17,5 @@ public class AudioFilter: TGFilter { } public extension TGFilter { - static var audio = AudioFilter() + static var audio: AudioFilter { AudioFilter() } } diff --git a/Sources/telegram-vapor-bot-lib/Bot/Filters/CaptionEntityFilter.swift b/Sources/telegram-vapor-bot-lib/Bot/Filters/CaptionEntityFilter.swift index 87f7692..783604c 100644 --- a/Sources/telegram-vapor-bot-lib/Bot/Filters/CaptionEntityFilter.swift +++ b/Sources/telegram-vapor-bot-lib/Bot/Filters/CaptionEntityFilter.swift @@ -28,7 +28,7 @@ public class CaptionEntityFilter: TGFilter { } public extension TGFilter { - static func captionEntity(type: TGMessageEntityType) -> TGFilter { + static func captionEntity(type: TGMessageEntityType) -> CaptionEntityFilter { return CaptionEntityFilter(type: type) } } diff --git a/Sources/telegram-vapor-bot-lib/Bot/Filters/ChatFilter.swift b/Sources/telegram-vapor-bot-lib/Bot/Filters/ChatFilter.swift index 60c7a9e..3d72e39 100644 --- a/Sources/telegram-vapor-bot-lib/Bot/Filters/ChatFilter.swift +++ b/Sources/telegram-vapor-bot-lib/Bot/Filters/ChatFilter.swift @@ -30,7 +30,7 @@ public class ChatFilter: TGFilter { } public extension TGFilter { - static func chat(chatId: Int64, username: String? = nil) -> TGFilter { + static func chat(chatId: Int64, username: String? = nil) -> ChatFilter { return ChatFilter(chatId: chatId, username: username) } } diff --git a/Sources/telegram-vapor-bot-lib/Bot/Filters/CommandFilter.swift b/Sources/telegram-vapor-bot-lib/Bot/Filters/CommandFilter.swift index bbfa573..d0af280 100644 --- a/Sources/telegram-vapor-bot-lib/Bot/Filters/CommandFilter.swift +++ b/Sources/telegram-vapor-bot-lib/Bot/Filters/CommandFilter.swift @@ -25,8 +25,10 @@ public class CommandFilter: TGFilter { for name in names { if message.contains(command: name) { trigger = true + break } } + return entity.contains(where: { $0.type == .botCommand }) && trigger } else { return entity.contains(where: { $0.type == .botCommand }) @@ -35,5 +37,5 @@ public class CommandFilter: TGFilter { } public extension TGFilter { - static var command = CommandFilter() + static var command: CommandFilter { CommandFilter() } } diff --git a/Sources/telegram-vapor-bot-lib/Bot/Filters/ContactFilter.swift b/Sources/telegram-vapor-bot-lib/Bot/Filters/ContactFilter.swift index e124d68..8d726d1 100644 --- a/Sources/telegram-vapor-bot-lib/Bot/Filters/ContactFilter.swift +++ b/Sources/telegram-vapor-bot-lib/Bot/Filters/ContactFilter.swift @@ -18,5 +18,5 @@ public class ContactFilter: TGFilter { } public extension TGFilter { - static var contact = ContactFilter() + static var contact: ContactFilter { ContactFilter() } } diff --git a/Sources/telegram-vapor-bot-lib/Bot/Filters/DocumentFilter.swift b/Sources/telegram-vapor-bot-lib/Bot/Filters/DocumentFilter.swift index 88fd223..d660725 100644 --- a/Sources/telegram-vapor-bot-lib/Bot/Filters/DocumentFilter.swift +++ b/Sources/telegram-vapor-bot-lib/Bot/Filters/DocumentFilter.swift @@ -18,5 +18,5 @@ public class DocumentFilter: TGFilter { } public extension TGFilter { - static var document = DocumentFilter() + static var document: DocumentFilter { DocumentFilter() } } diff --git a/Sources/telegram-vapor-bot-lib/Bot/Filters/EntityFilter.swift b/Sources/telegram-vapor-bot-lib/Bot/Filters/EntityFilter.swift index a46fd3d..267a8dd 100644 --- a/Sources/telegram-vapor-bot-lib/Bot/Filters/EntityFilter.swift +++ b/Sources/telegram-vapor-bot-lib/Bot/Filters/EntityFilter.swift @@ -27,7 +27,7 @@ public class EntityFilter: TGFilter { } public extension TGFilter { - static func entity(types: [TGMessageEntityType]) -> TGFilter { + static func entity(types: [TGMessageEntityType]) -> EntityFilter { return EntityFilter(types: types) } } diff --git a/Sources/telegram-vapor-bot-lib/Bot/Filters/ForwarderFilter.swift b/Sources/telegram-vapor-bot-lib/Bot/Filters/ForwarderFilter.swift index 46bd22d..14997ff 100644 --- a/Sources/telegram-vapor-bot-lib/Bot/Filters/ForwarderFilter.swift +++ b/Sources/telegram-vapor-bot-lib/Bot/Filters/ForwarderFilter.swift @@ -22,5 +22,5 @@ public class ForwarderFilter: TGFilter { } public extension TGFilter { - static var forwarded = ForwarderFilter() + static var forwarded: ForwarderFilter { ForwarderFilter() } } diff --git a/Sources/telegram-vapor-bot-lib/Bot/Filters/GameFilter.swift b/Sources/telegram-vapor-bot-lib/Bot/Filters/GameFilter.swift index 524286b..0f97ab2 100644 --- a/Sources/telegram-vapor-bot-lib/Bot/Filters/GameFilter.swift +++ b/Sources/telegram-vapor-bot-lib/Bot/Filters/GameFilter.swift @@ -18,5 +18,5 @@ public class GameFilter: TGFilter { } public extension TGFilter { - static var game = GameFilter() + static var game: GameFilter { GameFilter() } } diff --git a/Sources/telegram-vapor-bot-lib/Bot/Filters/GroupFilter.swift b/Sources/telegram-vapor-bot-lib/Bot/Filters/GroupFilter.swift index b0513bf..2013cd7 100644 --- a/Sources/telegram-vapor-bot-lib/Bot/Filters/GroupFilter.swift +++ b/Sources/telegram-vapor-bot-lib/Bot/Filters/GroupFilter.swift @@ -18,5 +18,5 @@ public class GroupFilter: TGFilter { } public extension TGFilter { - static var group = GroupFilter() + static var group: GroupFilter { GroupFilter() } } diff --git a/Sources/telegram-vapor-bot-lib/Bot/Filters/InvoiceFilter.swift b/Sources/telegram-vapor-bot-lib/Bot/Filters/InvoiceFilter.swift index c8775fa..5ad8660 100644 --- a/Sources/telegram-vapor-bot-lib/Bot/Filters/InvoiceFilter.swift +++ b/Sources/telegram-vapor-bot-lib/Bot/Filters/InvoiceFilter.swift @@ -18,5 +18,5 @@ public class InvoiceFilter: TGFilter { } public extension TGFilter { - static var invoice = InvoiceFilter() + static var invoice: InvoiceFilter { InvoiceFilter() } } diff --git a/Sources/telegram-vapor-bot-lib/Bot/Filters/LanguageFilter.swift b/Sources/telegram-vapor-bot-lib/Bot/Filters/LanguageFilter.swift index 2fd7135..560a16f 100644 --- a/Sources/telegram-vapor-bot-lib/Bot/Filters/LanguageFilter.swift +++ b/Sources/telegram-vapor-bot-lib/Bot/Filters/LanguageFilter.swift @@ -28,7 +28,7 @@ public class LanguageFilter: TGFilter { } public extension TGFilter { - static func language(_ lang: String) -> TGFilter { + static func language(_ lang: String) -> LanguageFilter { return LanguageFilter(lang: lang) } } diff --git a/Sources/telegram-vapor-bot-lib/Bot/Filters/LocationFilter.swift b/Sources/telegram-vapor-bot-lib/Bot/Filters/LocationFilter.swift index 0052d49..09dcff7 100644 --- a/Sources/telegram-vapor-bot-lib/Bot/Filters/LocationFilter.swift +++ b/Sources/telegram-vapor-bot-lib/Bot/Filters/LocationFilter.swift @@ -18,5 +18,5 @@ public class LocationFilter: TGFilter { } public extension TGFilter { - static var location = LocationFilter() + static var location: LocationFilter { LocationFilter() } } diff --git a/Sources/telegram-vapor-bot-lib/Bot/Filters/PhotoFilter.swift b/Sources/telegram-vapor-bot-lib/Bot/Filters/PhotoFilter.swift index 4419fe7..57e00e2 100644 --- a/Sources/telegram-vapor-bot-lib/Bot/Filters/PhotoFilter.swift +++ b/Sources/telegram-vapor-bot-lib/Bot/Filters/PhotoFilter.swift @@ -19,5 +19,5 @@ public class PhotoFilter: TGFilter { } public extension TGFilter { - static var photo = PhotoFilter() + static var photo: PhotoFilter { PhotoFilter() } } diff --git a/Sources/telegram-vapor-bot-lib/Bot/Filters/PrivateFilter.swift b/Sources/telegram-vapor-bot-lib/Bot/Filters/PrivateFilter.swift index 8b5ca6c..2641116 100644 --- a/Sources/telegram-vapor-bot-lib/Bot/Filters/PrivateFilter.swift +++ b/Sources/telegram-vapor-bot-lib/Bot/Filters/PrivateFilter.swift @@ -18,5 +18,5 @@ public class PrivateFilter: TGFilter { } public extension TGFilter { - static var `private` = PrivateFilter() + static var `private`: PrivateFilter { PrivateFilter() } } diff --git a/Sources/telegram-vapor-bot-lib/Bot/Filters/RegexpFilter.swift b/Sources/telegram-vapor-bot-lib/Bot/Filters/RegexpFilter.swift index 06eb4bb..44832f9 100644 --- a/Sources/telegram-vapor-bot-lib/Bot/Filters/RegexpFilter.swift +++ b/Sources/telegram-vapor-bot-lib/Bot/Filters/RegexpFilter.swift @@ -30,7 +30,7 @@ public class RegexpFilter: TGFilter { } public extension TGFilter { - static func regexp(pattern: String, options: NSRegularExpression.Options = []) -> TGFilter { + static func regexp(pattern: String, options: NSRegularExpression.Options = []) -> RegexpFilter { return RegexpFilter(pattern: pattern, options: options) } } diff --git a/Sources/telegram-vapor-bot-lib/Bot/Filters/ReplyFilter.swift b/Sources/telegram-vapor-bot-lib/Bot/Filters/ReplyFilter.swift index e4b837c..f7ddf0d 100644 --- a/Sources/telegram-vapor-bot-lib/Bot/Filters/ReplyFilter.swift +++ b/Sources/telegram-vapor-bot-lib/Bot/Filters/ReplyFilter.swift @@ -18,5 +18,5 @@ public class ReplyFilter: TGFilter { } public extension TGFilter { - static var reply = ReplyFilter() + static var reply: ReplyFilter { ReplyFilter() } } diff --git a/Sources/telegram-vapor-bot-lib/Bot/Filters/StatusUpdateFilters.swift b/Sources/telegram-vapor-bot-lib/Bot/Filters/StatusUpdateFilters.swift index a7b453a..315605f 100644 --- a/Sources/telegram-vapor-bot-lib/Bot/Filters/StatusUpdateFilters.swift +++ b/Sources/telegram-vapor-bot-lib/Bot/Filters/StatusUpdateFilters.swift @@ -13,28 +13,28 @@ import Foundation */ public struct StatusUpdateFilters { /// Messages that contain Message.groupChatCreated, Message.supergroupChatCreated or Message.channelChatCreated - public static var chatCreated: TGFilter { return ChatCreatedFilter() } + public static var chatCreated: ChatCreatedFilter { return ChatCreatedFilter() } /// Messages that contain Message.deleteChatPhoto - public static var deleteChatPhoto: TGFilter { return DeleteChatPhotoFilter() } + public static var deleteChatPhoto: DeleteChatPhotoFilter { return DeleteChatPhotoFilter() } /// Messages that contain Message.leftChatMember - public static var leftChatMember: TGFilter { return LeftChatMemberFilter() } + public static var leftChatMember: LeftChatMemberFilter { return LeftChatMemberFilter() } /// Messages that contain Message.migrateFromChatId - public static var migrate: TGFilter { return MigrateFilter() } + public static var migrate: MigrateFilter { return MigrateFilter() } /// Messages that contain Message.newChatMembers - public static var newChatMembers: TGFilter { return NewChatMembersFilter() } + public static var newChatMembers: NewChatMembersFilter { return NewChatMembersFilter() } /// Messages that contain Message.newChatPhoto - public static var newChatPhoto: TGFilter { return NewChatPhotoFilter() } + public static var newChatPhoto: NewChatPhotoFilter { return NewChatPhotoFilter() } /// Messages that contain Message.newChatTitle - public static var newChatTitle: TGFilter { return NewChatTitleFilter() } + public static var newChatTitle: NewChatTitleFilter { return NewChatTitleFilter() } /// Messages that contain Message.pinnedMessage - public static var pinnedMessage: TGFilter { return PinnedMessageFilter() } + public static var pinnedMessage: PinnedMessageFilter { return PinnedMessageFilter() } } /// Messages that contain Message.groupChatCreated, Message.supergroupChatCreated or Message.channelChatCreated diff --git a/Sources/telegram-vapor-bot-lib/Bot/Filters/StickerFilter.swift b/Sources/telegram-vapor-bot-lib/Bot/Filters/StickerFilter.swift index 5017df2..89ed034 100644 --- a/Sources/telegram-vapor-bot-lib/Bot/Filters/StickerFilter.swift +++ b/Sources/telegram-vapor-bot-lib/Bot/Filters/StickerFilter.swift @@ -18,5 +18,5 @@ public class StickerFilter: TGFilter { } public extension TGFilter { - static var sticker = StickerFilter() + static var sticker: StickerFilter { StickerFilter() } } diff --git a/Sources/telegram-vapor-bot-lib/Bot/Filters/SuccesfulPaymentFilter.swift b/Sources/telegram-vapor-bot-lib/Bot/Filters/SuccesfulPaymentFilter.swift index bf722d6..25dac84 100644 --- a/Sources/telegram-vapor-bot-lib/Bot/Filters/SuccesfulPaymentFilter.swift +++ b/Sources/telegram-vapor-bot-lib/Bot/Filters/SuccesfulPaymentFilter.swift @@ -18,5 +18,5 @@ public class SuccesfulPaymentFilter: TGFilter { } public extension TGFilter { - static var successfulPayment = SuccesfulPaymentFilter() + static var successfulPayment: SuccesfulPaymentFilter { SuccesfulPaymentFilter() } } diff --git a/Sources/telegram-vapor-bot-lib/Bot/Filters/TextFilter.swift b/Sources/telegram-vapor-bot-lib/Bot/Filters/TextFilter.swift index 95dcac6..6195bd5 100644 --- a/Sources/telegram-vapor-bot-lib/Bot/Filters/TextFilter.swift +++ b/Sources/telegram-vapor-bot-lib/Bot/Filters/TextFilter.swift @@ -19,5 +19,5 @@ public class TextFilter: TGFilter { } public extension TGFilter { - static var text = TextFilter() + static var text: TextFilter { TextFilter() } } diff --git a/Sources/telegram-vapor-bot-lib/Bot/Filters/UserFilter.swift b/Sources/telegram-vapor-bot-lib/Bot/Filters/UserFilter.swift index 31724d4..7b6609c 100644 --- a/Sources/telegram-vapor-bot-lib/Bot/Filters/UserFilter.swift +++ b/Sources/telegram-vapor-bot-lib/Bot/Filters/UserFilter.swift @@ -85,23 +85,23 @@ public class UserFilter: TGFilter { } public extension TGFilter { - static func user(userId: Int64) -> TGFilter { + static func user(userId: Int64) -> UserFilter { return UserFilter(userId: userId) } - static func user(username: String) -> TGFilter { + static func user(username: String) -> UserFilter { return UserFilter(username: username) } - static func user(userIds: [Int64]) -> TGFilter { + static func user(userIds: [Int64]) -> UserFilter { return UserFilter(userIds: userIds) } - static func user(usernames: [String]) -> TGFilter { + static func user(usernames: [String]) -> UserFilter { return UserFilter(usernames: usernames) } - static func user(userIds: [Int64], usernames: [String]) -> TGFilter { + static func user(userIds: [Int64], usernames: [String]) -> UserFilter { return UserFilter(userIds: userIds, usernames: usernames) } } diff --git a/Sources/telegram-vapor-bot-lib/Bot/Filters/VenueFilter.swift b/Sources/telegram-vapor-bot-lib/Bot/Filters/VenueFilter.swift index 4bb2f75..7538ea5 100644 --- a/Sources/telegram-vapor-bot-lib/Bot/Filters/VenueFilter.swift +++ b/Sources/telegram-vapor-bot-lib/Bot/Filters/VenueFilter.swift @@ -18,5 +18,5 @@ public class VenueFilter: TGFilter { } public extension TGFilter { - static var venue = VenueFilter() + static var venue: VenueFilter { VenueFilter() } } diff --git a/Sources/telegram-vapor-bot-lib/Bot/Filters/VideoFilter.swift b/Sources/telegram-vapor-bot-lib/Bot/Filters/VideoFilter.swift index 9445232..60ef59b 100644 --- a/Sources/telegram-vapor-bot-lib/Bot/Filters/VideoFilter.swift +++ b/Sources/telegram-vapor-bot-lib/Bot/Filters/VideoFilter.swift @@ -18,5 +18,5 @@ public class VideoFilter: TGFilter { } public extension TGFilter { - static var video = VideoFilter() + static var video: VideoFilter { VideoFilter() } } diff --git a/Sources/telegram-vapor-bot-lib/Bot/Filters/VideoNoteFilter.swift b/Sources/telegram-vapor-bot-lib/Bot/Filters/VideoNoteFilter.swift index 3931594..9cfe704 100644 --- a/Sources/telegram-vapor-bot-lib/Bot/Filters/VideoNoteFilter.swift +++ b/Sources/telegram-vapor-bot-lib/Bot/Filters/VideoNoteFilter.swift @@ -18,5 +18,5 @@ public class VideoNoteFilter: TGFilter { } public extension TGFilter { - static var videoNote = VideoNoteFilter() + static var videoNote: VideoNoteFilter { VideoNoteFilter() } } diff --git a/Sources/telegram-vapor-bot-lib/Bot/Filters/VoiceFilter.swift b/Sources/telegram-vapor-bot-lib/Bot/Filters/VoiceFilter.swift index 0e8346e..ba16fce 100644 --- a/Sources/telegram-vapor-bot-lib/Bot/Filters/VoiceFilter.swift +++ b/Sources/telegram-vapor-bot-lib/Bot/Filters/VoiceFilter.swift @@ -18,5 +18,5 @@ public class VoiceFilter: TGFilter { } public extension TGFilter { - static var voice = VoiceFilter() + static var voice: VoiceFilter { VoiceFilter() } }