From 5326cb6ce37fee714235b2fe09a42d5bbe700435 Mon Sep 17 00:00:00 2001 From: Valeriy Van Date: Tue, 23 Apr 2024 23:56:50 +0300 Subject: [PATCH 1/4] Avoid confusion in error message when no description/reason provided (#26) --- Sources/TelegramVaporBot/Telegrammer/Errors/BotError.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Sources/TelegramVaporBot/Telegrammer/Errors/BotError.swift b/Sources/TelegramVaporBot/Telegrammer/Errors/BotError.swift index a5e52cc..2857147 100644 --- a/Sources/TelegramVaporBot/Telegrammer/Errors/BotError.swift +++ b/Sources/TelegramVaporBot/Telegrammer/Errors/BotError.swift @@ -46,7 +46,7 @@ public class BotError: ErrorCommon { self.description = "\(Self.self)" } - public init(type: Type, description: String = "", reason: String = "") { + public init(type: Type, description: String = "", reason: String = "") { self.type = type self.description = description self.reason = reason From 4ab9ae1599ea3ed09e73aa080dddbf4cf32a4e2a Mon Sep 17 00:00:00 2001 From: Valeriy Van Date: Wed, 24 Apr 2024 15:40:24 +0300 Subject: [PATCH 2/4] Fix deprecation in Telegram-bot-example (#27) --- Telegram-bot-example/Sources/Telegram-bot-example/main.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Telegram-bot-example/Sources/Telegram-bot-example/main.swift b/Telegram-bot-example/Sources/Telegram-bot-example/main.swift index 5266e54..80c3372 100644 --- a/Telegram-bot-example/Sources/Telegram-bot-example/main.swift +++ b/Telegram-bot-example/Sources/Telegram-bot-example/main.swift @@ -9,4 +9,4 @@ let TGBOT: TGBotConnection = .init() defer { app.shutdown() } try await configure(app) -try app.run() +try await app.execute() From f90d10d2ba03493eef7f993a642ab86c437f6d65 Mon Sep 17 00:00:00 2001 From: Valeriy Van Date: Mon, 13 May 2024 05:51:13 +0300 Subject: [PATCH 3/4] Fix typo in error description (#24) --- .../Telegrammer/Helpers/Constants.swift | 23 ------------------- .../Telegrammer/Helpers/Error+Helpers.swift | 2 +- 2 files changed, 1 insertion(+), 24 deletions(-) delete mode 100644 Sources/TelegramVaporBot/Telegrammer/Helpers/Constants.swift diff --git a/Sources/TelegramVaporBot/Telegrammer/Helpers/Constants.swift b/Sources/TelegramVaporBot/Telegrammer/Helpers/Constants.swift deleted file mode 100644 index e09f7c2..0000000 --- a/Sources/TelegramVaporBot/Telegrammer/Helpers/Constants.swift +++ /dev/null @@ -1,23 +0,0 @@ -// -// Constants.swift -// Telegrammer -// -// Created by Givi Pataridze on 11/06/2018. -// - -import Foundation - -//public struct Const { -// static let MessageMaxLength: Int = 4096 -// static let CaptionMaxLength: Int = 200 -// static let WebhooksSupportedPorts: [Int] = [443, 80, 88, 8443] -// static let DownloadFileMaxSize: Int = 20 //TODO: rewrite in bytes, now in Mbytes -// static let UploadFileMaxSize: Int = 50 //TODO: rewrite in bytes, now in Mbytes -// ///Telegram may allow short bursts that go over this limit, but eventually you’ll begin receiving 429 errors. -// static let MessagesMaxPerSecondPerChat: Int = 1 -// static let MessagesMaxPerSecond: Int = 30 -// static let MessagesMaxPerMinutePerGroup: Int = 20 -// static let InlineQueryMaxResults: Int = 50 -// ///Beyond this cap telegram will simply ignore further formatting styles -// static let MessagesMaxEntities: Int = 100 -//} diff --git a/Sources/TelegramVaporBot/Telegrammer/Helpers/Error+Helpers.swift b/Sources/TelegramVaporBot/Telegrammer/Helpers/Error+Helpers.swift index b8bc463..0b5c29d 100644 --- a/Sources/TelegramVaporBot/Telegrammer/Helpers/Error+Helpers.swift +++ b/Sources/TelegramVaporBot/Telegrammer/Helpers/Error+Helpers.swift @@ -24,7 +24,7 @@ public extension Error { case .valueNotFound(_, let context): errorDescription = context.debugDescription @unknown default: - errorDescription = "Uknown DecodingError" + errorDescription = "Unknown DecodingError" } } else { errorDescription = "Cannot detect error type, providing default description:\n\(self.localizedDescription)" From e5ca91588c6c6ec0df656e72038b0f1ae46c6eca Mon Sep 17 00:00:00 2001 From: Valeriy Van Date: Sun, 19 May 2024 10:57:18 +0300 Subject: [PATCH 4/4] Fix warning in Telegram-bot-example/main.swift (#28) * Fix warning in Telegram-bot-example/main.swift * Remove force from force try --- Telegram-bot-example/Sources/Telegram-bot-example/main.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Telegram-bot-example/Sources/Telegram-bot-example/main.swift b/Telegram-bot-example/Sources/Telegram-bot-example/main.swift index 80c3372..59ef441 100644 --- a/Telegram-bot-example/Sources/Telegram-bot-example/main.swift +++ b/Telegram-bot-example/Sources/Telegram-bot-example/main.swift @@ -4,7 +4,7 @@ import TelegramVaporBot var env = try Environment.detect() try LoggingSystem.bootstrap(from: &env) let eventLoop: EventLoopGroup = MultiThreadedEventLoopGroup(numberOfThreads: System.coreCount * 4) -let app: Application = .init(env, Application.EventLoopGroupProvider.shared(eventLoop)) +let app: Application = try await Application.make(env, Application.EventLoopGroupProvider.shared(eventLoop)) let TGBOT: TGBotConnection = .init() defer { app.shutdown() }