This package is part of TelegramBotSDK
You need just to add these lines to your Vapor app:
- Add
.package(url: "https://github.com/rapierorg/telegram-bot-swift-vapor-provider.git", from: "0.2.1"),
- Add
TelegramBotSDKVaporProvider
to yourApp
target dependencies
Add the following lines to your configure function:
services.register(TelegramBotConfig(apiToken: "your-api-token-here", routerConfiguration: { (router) in
// Configure TelegramBotSDK router here
}))
try services.register(TelegramBotProvider())
router.post("change", "me") { (request) -> HTTPStatus in // Change route
let telegramClient = try request.make(TelegramBotClient.self)
try telegramClient.handleRequest(request)
return .ok
}
let telegramClient = try app.make(TelegramBotClient.self)
telegramClient.bot.setWebhookSync(url: "your-webhook-url-here")