diff --git a/Sources/TelegramModeratorBot/DefaultBotHandlers.swift b/Sources/TelegramModeratorBot/DefaultBotHandlers.swift index ef4039f..f2b359e 100644 --- a/Sources/TelegramModeratorBot/DefaultBotHandlers.swift +++ b/Sources/TelegramModeratorBot/DefaultBotHandlers.swift @@ -1,5 +1,5 @@ import Vapor -import SwiftTelegramSdk +@preconcurrency import SwiftTelegramSdk final class DefaultBotHandlers { static func addHandlers() async { diff --git a/Sources/TelegramModeratorBot/TGBotActor.swift b/Sources/TelegramModeratorBot/TGBotActor.swift index 2ea8509..8b1973c 100644 --- a/Sources/TelegramModeratorBot/TGBotActor.swift +++ b/Sources/TelegramModeratorBot/TGBotActor.swift @@ -1,4 +1,4 @@ -import SwiftTelegramSdk +@preconcurrency import SwiftTelegramSdk actor TGBotActor { private var _bot: TGBot! diff --git a/Sources/TelegramModeratorBot/configure.swift b/Sources/TelegramModeratorBot/configure.swift index 9d8f585..cf13f47 100644 --- a/Sources/TelegramModeratorBot/configure.swift +++ b/Sources/TelegramModeratorBot/configure.swift @@ -1,6 +1,6 @@ import Foundation import Vapor -import SwiftTelegramSdk +@preconcurrency import SwiftTelegramSdk public func configure(_ app: Application) async throws { guard let tgApi: String = Environment.get("TG_BOT_API") else { throw Errors.notVariable("Telegram key is not defined")} diff --git a/Sources/TelegramModeratorBot/main.swift b/Sources/TelegramModeratorBot/main.swift index 230fce6..01e926c 100644 --- a/Sources/TelegramModeratorBot/main.swift +++ b/Sources/TelegramModeratorBot/main.swift @@ -12,7 +12,6 @@ let app: Application = try await Application.make(env, Application.EventLoopGrou let botActor: TGBotActor = .init() -defer { app.shutdown() } - try await configure(app) try await app.execute() +try await app.asyncShutdown()