From a64867c3f8ac98cb7bd7e7d45228a6344cc7838b Mon Sep 17 00:00:00 2001 From: Keroosha Date: Sat, 25 Feb 2023 02:46:05 +0300 Subject: [PATCH 1/2] Do not die on updateHandle ever again --- PublishHelperBot/Program.fs | 28 +++++++++++++++++----------- 1 file changed, 17 insertions(+), 11 deletions(-) diff --git a/PublishHelperBot/Program.fs b/PublishHelperBot/Program.fs index 0d55e66..1a05524 100644 --- a/PublishHelperBot/Program.fs +++ b/PublishHelperBot/Program.fs @@ -5,6 +5,7 @@ open System.Threading.Tasks open PublishHelperBot.Handlers open PublishHelperBot.Environment open PublishHelperBot.YoutubeDl +open Serilog.Core open Telegram.Bot open Telegram.Bot.Polling open Telegram.Bot.Types @@ -46,17 +47,22 @@ let (|ObsoleteUpdate|RelayMatchUpdate|YoutubeRepostMatchUpdate|SkipUpdate|) (upd let updateHandle (bc: ITelegramBotClient) (update: Update) (ct: CancellationToken): Task = let tgCtx = (update, config, bc) - match update with - | RelayMatchUpdate() -> - Logging.logger.Information("RelayMatchUpdate") - RelayHandler tgCtx - | YoutubeRepostMatchUpdate() -> - YoutubeRepostHandler <| (youtubeDlService, tgCtx) - | ObsoleteUpdate() -> - Logging.logger.Information("Skipping obsolete update") - Task.CompletedTask - | SkipUpdate() -> - Logging.logger.Information("Skipping update") + try + match update with + | RelayMatchUpdate() -> + Logging.logger.Information("RelayMatchUpdate") + RelayHandler tgCtx + | YoutubeRepostMatchUpdate() -> + YoutubeRepostHandler <| (youtubeDlService, tgCtx) + | ObsoleteUpdate() -> + Logging.logger.Information("Skipping obsolete update") + Task.CompletedTask + | SkipUpdate() -> + Logging.logger.Information("Skipping update") + Task.CompletedTask + with + | e -> + $"Случилась страшная хуйня:\n {e.Message}\n{e.StackTrace}" |> Logging.logger.Error Task.CompletedTask let handlePollingError (_: ITelegramBotClient) (e: Exception) (_: CancellationToken) = From 68840ef0062b0445ee544a35d5c962d985f03996 Mon Sep 17 00:00:00 2001 From: Alexander Pushkov Date: Sat, 25 Feb 2023 00:04:12 +0000 Subject: [PATCH 2/2] Add LICENSE --- LICENSE | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 LICENSE diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..6b1af5f --- /dev/null +++ b/LICENSE @@ -0,0 +1,16 @@ + THE STRONGEST PUBLIC LICENSE + Draft 1, November 2010 + +Everyone is permitted to copy and distribute verbatim or modified +copies of this license document, and changing it is allowed as long +as the name is changed. + + THE STRONGEST PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + +⑨. This license document permits you to DO WHAT THE FUCK YOU WANT TO + as long as you APPRECIATE CIRNO AS THE STRONGEST IN GENSOKYO. + +This program is distributed in the hope that it will be THE STRONGEST, +but WITHOUT ANY WARRANTY; without even the implied warranty of +USEFULNESS or FITNESS FOR A PARTICULAR PURPOSE.