rapierorg / telegram-bot-swift

Telegram Bot SDK for Swift (unofficial)
https://github.com/rapierorg/telegram-bot-swift/wiki
Apache License 2.0
375 stars 63 forks source link

Fatal error: Server stopped due to error: nil: file Bot/main.swift #118

Closed ghost closed 1 year ago

ghost commented 3 years ago

Hello, I just noticed that all of my projects which include this library started throwing this error for some unknown reason. Example code:

import Foundation
import TelegramBotSDK

let bot = TelegramBot(token: "TOKEN")
let router = Router(bot: bot)

router["start"] = { context in
    guard let from = context.message?.from else { return false }
    context.respondAsync("Hello!")
    return true
}

fatalError("Server stopped due to error: \(bot.lastError)") // throws error at this line, bot.lastError is nil, I guess

Is there a way to fix this?

nerzh commented 3 years ago

it seems they don't support it, maybe you try my package for Vapor https://github.com/nerzh/telegram-vapor-bot

zmeyc commented 2 years ago

macOS / Linux? Swift version?