diff --git a/README.md b/README.md index c3440cc..68d6130 100644 --- a/README.md +++ b/README.md @@ -64,7 +64,6 @@ You can choose two ways to configure grinder but keep in mind about configuratio "Token": "test", "ChannelId": 111, "AdminUserId": 123, - "RunAzureWebServer": true, "Socks5Proxy": { "Hostname": "Hostme", "Port": 1337, @@ -72,8 +71,8 @@ You can choose two ways to configure grinder but keep in mind about configuratio "Password": "Secrete" }, "ChatsToMonitor": [ - "@Sample", - "@Text" + "Sample", + "Text" ], "AllowedUsers": [ "Pasha", @@ -103,8 +102,8 @@ Grinder_Bot__AllowedUsers__0=Pasha Grinder_Bot__AllowedUsers__1=Technique #ChatsToMonitor - chats where bot will read messages and replies -Grinder_Bot__ChatsToMonitor__0=@Sample -Grinder_Bot__ChatsToMonitor__1=@Text +Grinder_Bot__ChatsToMonitor__0=Sample +Grinder_Bot__ChatsToMonitor__1=Text #AdminUserId - telegram user id who will be able to send private messages to bot Grinder_Bot__AdminUserId=123 diff --git a/src/Grinder/Datastore.fs b/src/Grinder/Datastore.fs index f1046c2..9a9e30d 100644 --- a/src/Grinder/Datastore.fs +++ b/src/Grinder/Datastore.fs @@ -1,6 +1,5 @@ namespace Grinder -open System open FSharp.Control.Tasks.V2 open Microsoft.EntityFrameworkCore open Grinder.DataAccess @@ -29,7 +28,7 @@ module Datastore = use context = new GrinderContext() let! user = context.Users - .FirstOrDefaultAsync(fun u -> u.Username.Equals(username.TrimStart('@'), StringComparison.InvariantCultureIgnoreCase)) + .FirstOrDefaultAsync(fun u -> u.Username = username.TrimStart('@')) return user |> Option.ofObj |> Option.fold (fun _ u -> UserIdFound u.UserId) UserIdNotFound diff --git a/src/Grinder/Program.fs b/src/Grinder/Program.fs index 73e9106..db29908 100644 --- a/src/Grinder/Program.fs +++ b/src/Grinder/Program.fs @@ -36,7 +36,6 @@ module Program = AllowedUsers: string array ChannelId: int64 AdminUserId: int64 - DisableAzureWebServer: bool } [] @@ -173,21 +172,18 @@ module Program = printfn "Bot started" - if not config.DisableAzureWebServer then - // Needed for azure web app deploy check. We have to response with anything on port 80 - use listener = new HttpListener() - listener.Prefixes.Add("http://*:80/") - listener.Start() - - let buffer = System.Text.Encoding.UTF8.GetBytes "OK" - - while true do - let ctx = listener.GetContext() - let output = ctx.Response.OutputStream - output.Write(buffer, 0, buffer.Length) - output.Close() - else - Console.ReadLine () |> ignore + // Needed for azure web app deploy check. We have to response with anything on port 80 + use listener = new HttpListener() + listener.Prefixes.Add("http://*:80/") + listener.Start() + + let buffer = System.Text.Encoding.UTF8.GetBytes "OK" + + while true do + let ctx = listener.GetContext() + let output = ctx.Response.OutputStream + output.Write(buffer, 0, buffer.Length) + output.Close(); printfn "Bot exited" 0 // return an integer exit code \ No newline at end of file diff --git a/src/Grinder/appsettings.json b/src/Grinder/appsettings.json index 1e1c731..2b88449 100644 --- a/src/Grinder/appsettings.json +++ b/src/Grinder/appsettings.json @@ -3,7 +3,6 @@ "Token": "REPLACEME", "ChannelId": 0, "AdminUserId": 0, - "DisableAzureWebServer": true, // uncomment if you need proxy // "Socks5Proxy": { // "Hostname": "REPLACEME",