Skip to content

Commit

Permalink
Program: get rid of UsePolling parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
ForNeVeR committed Oct 20, 2024
1 parent 3c89c2b commit ae45c3c
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 22 deletions.
21 changes: 0 additions & 21 deletions src/VahterBanBot/Program.fs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ let botConf =
AllowedUsers = getEnv "ALLOWED_USERS" |> fromJson
ShouldDeleteChannelMessages = getEnvOr "SHOULD_DELETE_CHANNEL_MESSAGES" "true" |> bool.Parse
IgnoreSideEffects = getEnvOr "IGNORE_SIDE_EFFECTS" "false" |> bool.Parse
UsePolling = getEnvOr "USE_POLLING" "false" |> bool.Parse
UseFakeTgApi = getEnvOr "USE_FAKE_TG_API" "false" |> bool.Parse
CleanupOldMessages = getEnvOr "CLEANUP_OLD_MESSAGES" "true" |> bool.Parse
CleanupInterval = getEnvOr "CLEANUP_INTERVAL_SEC" "86400" |> int |> TimeSpan.FromSeconds
Expand Down Expand Up @@ -189,24 +188,4 @@ let app = builder.Build()
app.UseGiraffe(webApp)
let server = app.RunAsync()

// Dev mode only
// TODO[F]: Figure this out
// if botConf.UsePolling then
// let telegramClient = app.Services.GetRequiredService<TelegramBotClient>()
// let pollingHandler = {
// new IUpdateHandler with
// member x.HandleUpdateAsync (botClient: ITelegramBotClient, update: Update, cancellationToken: CancellationToken) =
// task {
// if update.Message <> null && update.Message.Type = MessageType.Text then
// let ctx = app.Services.CreateScope()
// let logger = ctx.ServiceProvider.GetRequiredService<ILogger<IUpdateHandler>>()
// let client = ctx.ServiceProvider.GetRequiredService<ITelegramBotClient>()
// let ml = ctx.ServiceProvider.GetRequiredService<MachineLearning>()
// do! onUpdate botUser client botConf logger ml update
// }
// member this.HandleErrorAsync(botClient, ``exception``, source, cancellationToken) =
// Task.CompletedTask
// }
// telegramClient.StartReceiving(pollingHandler, null, CancellationToken.None)

server.Wait()
1 change: 0 additions & 1 deletion src/VahterBanBot/Types.fs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ type BotConfiguration =
ShouldDeleteChannelMessages: bool
IgnoreSideEffects: bool
UseFakeTgApi: bool
UsePolling: bool
CleanupOldMessages: bool
CleanupInterval: TimeSpan
CleanupOldLimit: TimeSpan
Expand Down

0 comments on commit ae45c3c

Please sign in to comment.