telegram-auth-bot/Sources/TelegramModeratorBot/DefaultBotHandlers.swift

19 lines
548 B
Swift
Raw Normal View History

2024-10-19 17:39:04 +03:00
import Vapor
@preconcurrency import SwiftTelegramSdk
2024-10-19 17:39:04 +03:00
final class DefaultBotHandlers {
static func addHandlers() async {
await defaultBaseHandler()
}
private static func defaultBaseHandler() async {
await botActor.bot.dispatcher.add(TGBaseHandler({ update in
guard let message = update.message else { return }
let params: TGSendMessageParams = .init(chatId: .chat(message.chat.id), text: """
Help message
""")
try await botActor.bot.sendMessage(params: params)
}))
}
}