 import Foundation
 import Dispatch
 
-public typealias UpdateHandler = (Result<Update>, ZEGBot) -> Void
+public typealias UpdateHandler = (Update, ZEGBot) -> Void
 
 public struct ZEGBot {
 

			task.resume()
			semaphore.wait()
		}
		NSLog("Exit due to error: \(encounterError!)")
		exit(2)
	}

}

		self.urlPrefix = "https://api.telegram.org/bot"+token+"/"
	}

	public func run(withHandler handler: @escaping UpdateHandler) throws {
		var offset = 0
		let semaphore = DispatchSemaphore(value: 0)
		var encounterError: Swift.Error?
		while encounterError == nil {
			let task = session.dataTask(with: URL(string: urlPrefix + "getupdates?timeout=60&offset=\(offset)")!) { data, _, error in
				guard let data = data else {
					encounterError = error!
					semaphore.signal()
					return
