diff --git a/Bot/Games/HackerBattle.fs b/Bot/Games/HackerBattle.fs index 26996d5..f295060 100644 --- a/Bot/Games/HackerBattle.fs +++ b/Bot/Games/HackerBattle.fs @@ -76,7 +76,7 @@ let strengthBonus attacker defender = |> (*) 0.01 |> (*) 200.0 // Bonus |> int - + let runHackerBattle defender (hack : HackItem) = defender |> Player.removeExpiredActions @@ -108,7 +108,7 @@ let updateCombatants successfulHack (attacker : PlayerData) (defender : PlayerDa DbService.addPlayerEvent defender.DiscordId (event true) ] |> Async.Parallel |> Async.Ignore - + let hackerResult successfulHack (ctx : IDiscordContext) attacker defender (hack : HackItem) = async { let prizeAmount , bonus = @@ -120,9 +120,9 @@ let hackerResult successfulHack (ctx : IDiscordContext) attacker defender (hack if hack.Power < int attacker.Bank then gbt hack.Power , 0 else attacker.Bank , 0 - + do! updateCombatants successfulHack attacker defender hack prizeAmount - + let! defenderMember = ctx.GetGuild().GetMemberAsync(defender.DiscordId) |> Async.AwaitTask let embed = Embeds.responseSuccessfulHack2 successfulHack attacker defender (ctx.GetDiscordMember()) defenderMember prizeAmount bonus hack do! ctx.GetChannel().SendMessageAsync(embed) @@ -368,7 +368,7 @@ type HackerGame() = [] member this.ScanCommand (ctx : InteractionContext) = enforceChannels (DiscordInteractionContext ctx) scan scan - + // [] member this.TestAutoComplete (ctx : InteractionContext) = async { @@ -377,4 +377,4 @@ type HackerGame() = do! ctx.Interaction.CreateResponseAsync(InteractionResponseType.ChannelMessageWithSource, builder) |> Async.AwaitTask } |> Async.StartAsTask - :> Task \ No newline at end of file + :> Task diff --git a/CurrencyAPI/Currency.fs b/CurrencyAPI/Currency.fs index b08ed56..763f3c3 100644 --- a/CurrencyAPI/Currency.fs +++ b/CurrencyAPI/Currency.fs @@ -23,7 +23,7 @@ let validateApiKey (ctx : HttpContext) = match ctx.TryGetRequestHeader "X-API-Key" with | Some key -> apiKey.Equals key | None -> false - + let accessDenied = setStatusCode 401 >=> text "Access Denied" let requiresApiKey = authorizeRequest validateApiKey accessDenied @@ -40,7 +40,7 @@ let getCurrentBalance (discordId : string) = | a::_ -> return Ok a } -let get (discordId : string) : HttpHandler = +let get (discordId : string) : HttpHandler = fun (next : HttpFunc) (ctx : HttpContext) -> task { try @@ -50,8 +50,8 @@ let get (discordId : string) : HttpHandler = with ex -> return! ServerErrors.internalError (json {| Error = ex.Message |}) next ctx } - -let modify sign (discordId : string) : HttpHandler = + +let modify sign (discordId : string) : HttpHandler = fun (next : HttpFunc) (ctx : HttpContext) -> task { let! body = ctx.BindJsonAsync<{|Amount:int|}>() @@ -72,7 +72,7 @@ let modify sign (discordId : string) : HttpHandler = with ex -> return! RequestErrors.notFound (json {| Error = ex.Message |}) next ctx | Error e -> return! RequestErrors.notFound (json {| Error = e |}) next ctx } - + let webApp = choose [ GET >=> requiresApiKey >=> routef "/user/%s/balance" get diff --git a/Dockerfile b/Dockerfile index d971799..5951f44 100644 --- a/Dockerfile +++ b/Dockerfile @@ -20,7 +20,6 @@ RUN dotnet publish "CurrencyAPI.fsproj" -c Release -o /app/publish --no-restore FROM mcr.microsoft.com/dotnet/aspnet:6.0 WORKDIR /app COPY --from=publish /app/publish . -EXPOSE 3333 EXPOSE 80 EXPOSE 443 ENTRYPOINT [ "dotnet", "./CurrencyAPI.App.dll" ]