Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
nerzh committed Jun 8, 2021
2 parents 5bcd7c2 + ddd4443 commit 27d6f5a
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
# telegram-vapor-bot-lib
# Telegram Vapor Bot

## Please support Swift Telegram Vapor Bot Lib development by giving a ⭐️

### Telegram Bot based on Swift Vapor.

### Example Here
[Telegram-bot-example](https://github.com/nerzh/telegram-vapor-bot-lib/tree/master/Telegram-bot-example)
[Telegram-bot-example](https://github.com/nerzh/telegram-vapor-bot/tree/master/Telegram-bot-example)

### Usage

#### create folder with your handlers **TGHandlers/DefaultBotHandlers.swift**
```swift
import Vapor
import telegram_vapor_bot_lib
import telegram_vapor_bot

final class DefaultBotHandlers {

Expand Down Expand Up @@ -44,6 +46,8 @@ final class DefaultBotHandlers {
#### for longpolling you should only configure vapor **configure.swift**

```swift
import telegram_vapor_bot

let tgApi: String = "XXXXXXXXXX:YYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYY"
let connection: TGConnectionPrtcl = TGLongPollingConnection()
TGBot.configure(connection: connection, botId: tgApi, vaporClient: app.client)
Expand All @@ -62,6 +66,8 @@ DefaultBotHandlers.addHandlers(app: app, bot: TGBot.shared)
#### vapor **configure.swift**

```swift
import telegram_vapor_bot

let tgApi: String = "XXXXXXXXXX:YYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYY"
let connection: TGConnectionPrtcl = TGWebHookConnection(webHookURL: "https://your_domain/some_webhook_route")
TGBot.configure(connection: connection, botId: tgApi, vaporClient: app.client)
Expand All @@ -77,7 +83,7 @@ DefaultBotHandlers.addHandlers(app: app, bot: TGBot.shared)

```swift
import Vapor
import telegram_vapor_bot_lib
import telegram_vapor_bot


func routes(_ app: Application) throws {
Expand Down Expand Up @@ -125,3 +131,7 @@ let package = Package(
]
)
```

### Acknowledgments

Inspired by [Telegrammer](https://github.com/givip/Telegrammer)

0 comments on commit 27d6f5a

Please sign in to comment.