diff --git a/Sources/telegram-vapor-bot/Bot/Filters/TextFilter.swift b/Sources/telegram-vapor-bot/Bot/Filters/TextFilter.swift index 6195bd5..ff961a1 100644 --- a/Sources/telegram-vapor-bot/Bot/Filters/TextFilter.swift +++ b/Sources/telegram-vapor-bot/Bot/Filters/TextFilter.swift @@ -10,12 +10,21 @@ import Foundation public class TextFilter: TGFilter { public var name: String = "text" + private var value: String? = nil override public func filter(message: TGMessage) -> Bool { guard let text = message.text else { return false } + if let value = value { + return text == value + } return !text.isEmpty } + + public func value(_ value: String) -> Self { + self.value = value + return self + } } public extension TGFilter {