nerzh / swift-telegram-sdk

🤖 The wrapper for the Telegram Bot API written in Swift. It's not a framework. There is no special syntax here. This is a library that implements all Telegram Bot API methods, which is available to you to work with Vapor, Smoke, Hummingbird, FlyingFox.
https://core.telegram.org/bots/api#available-methods
MIT License
216 stars 32 forks source link

Run on external device #33

Closed NikKovIos closed 2 months ago

NikKovIos commented 2 months ago

Hello, I'm sorry for the possibly stupid question.

I found how to launch a bot by building via xcode. But I don't quite understand how to run it on a remote machine, on a hosting? If anyone has any experience, please share how you run the bot.

nerzh commented 2 months ago

Compile your bot and run the binary. In the simplest variant use longpolling. But it is a bit slower than webhooks and there are cases when the bot stops responding.

If you want to use webhooks, you need an https certificate for the domain and you also need a domain for the bot. Configure nginx etc. What will be difficult to describe here, it is better to try to ask in the telegram chat which is specified in the readmi

NikKovIos commented 2 months ago

Thank you for answer. Can you please explain how to make a binary and run it on mac that don't have xcode? Now I can only run bot via xcode.

NikKovIos commented 2 months ago

I've found something like instruction https://biser.medium.com/how-to-create-a-telegram-bot-with-swift-using-vapor-d302d27b4844

NikKovIos commented 2 months ago

It seems I need to

1) Install swift 2) swift build 3) swift run