Whitespace it seems

This commit is contained in:
Joseph Ferano 2022-08-04 13:50:32 +07:00
parent 9e4a37baab
commit 3d1a863ab5
3 changed files with 11 additions and 12 deletions

View File

@ -76,7 +76,7 @@ let strengthBonus attacker defender =
|> (*) 0.01 |> (*) 0.01
|> (*) 200.0 // Bonus |> (*) 200.0 // Bonus
|> int |> int
let runHackerBattle defender (hack : HackItem) = let runHackerBattle defender (hack : HackItem) =
defender defender
|> Player.removeExpiredActions |> Player.removeExpiredActions
@ -108,7 +108,7 @@ let updateCombatants successfulHack (attacker : PlayerData) (defender : PlayerDa
DbService.addPlayerEvent defender.DiscordId (event true) ] DbService.addPlayerEvent defender.DiscordId (event true) ]
|> Async.Parallel |> Async.Parallel
|> Async.Ignore |> Async.Ignore
let hackerResult successfulHack (ctx : IDiscordContext) attacker defender (hack : HackItem) = let hackerResult successfulHack (ctx : IDiscordContext) attacker defender (hack : HackItem) =
async { async {
let prizeAmount , bonus = let prizeAmount , bonus =
@ -120,9 +120,9 @@ let hackerResult successfulHack (ctx : IDiscordContext) attacker defender (hack
if hack.Power < int attacker.Bank if hack.Power < int attacker.Bank
then gbt hack.Power , 0<GBT> then gbt hack.Power , 0<GBT>
else attacker.Bank , 0<GBT> else attacker.Bank , 0<GBT>
do! updateCombatants successfulHack attacker defender hack prizeAmount do! updateCombatants successfulHack attacker defender hack prizeAmount
let! defenderMember = ctx.GetGuild().GetMemberAsync(defender.DiscordId) |> Async.AwaitTask let! defenderMember = ctx.GetGuild().GetMemberAsync(defender.DiscordId) |> Async.AwaitTask
let embed = Embeds.responseSuccessfulHack2 successfulHack attacker defender (ctx.GetDiscordMember()) defenderMember prizeAmount bonus hack let embed = Embeds.responseSuccessfulHack2 successfulHack attacker defender (ctx.GetDiscordMember()) defenderMember prizeAmount bonus hack
do! ctx.GetChannel().SendMessageAsync(embed) do! ctx.GetChannel().SendMessageAsync(embed)
@ -368,7 +368,7 @@ type HackerGame() =
[<SlashCommand("scan", "Find 5 targets connected to the network we can try to hack")>] [<SlashCommand("scan", "Find 5 targets connected to the network we can try to hack")>]
member this.ScanCommand (ctx : InteractionContext) = member this.ScanCommand (ctx : InteractionContext) =
enforceChannels (DiscordInteractionContext ctx) scan scan enforceChannels (DiscordInteractionContext ctx) scan scan
// [<SlashCommand("test-autocomplete", "Create a passive defense that will last 24 hours")>] // [<SlashCommand("test-autocomplete", "Create a passive defense that will last 24 hours")>]
member this.TestAutoComplete (ctx : InteractionContext) = member this.TestAutoComplete (ctx : InteractionContext) =
async { async {
@ -377,4 +377,4 @@ type HackerGame() =
do! ctx.Interaction.CreateResponseAsync(InteractionResponseType.ChannelMessageWithSource, builder) do! ctx.Interaction.CreateResponseAsync(InteractionResponseType.ChannelMessageWithSource, builder)
|> Async.AwaitTask |> Async.AwaitTask
} |> Async.StartAsTask } |> Async.StartAsTask
:> Task :> Task

View File

@ -23,7 +23,7 @@ let validateApiKey (ctx : HttpContext) =
match ctx.TryGetRequestHeader "X-API-Key" with match ctx.TryGetRequestHeader "X-API-Key" with
| Some key -> apiKey.Equals key | Some key -> apiKey.Equals key
| None -> false | None -> false
let accessDenied = setStatusCode 401 >=> text "Access Denied" let accessDenied = setStatusCode 401 >=> text "Access Denied"
let requiresApiKey = authorizeRequest validateApiKey accessDenied let requiresApiKey = authorizeRequest validateApiKey accessDenied
@ -40,7 +40,7 @@ let getCurrentBalance (discordId : string) =
| a::_ -> return Ok a | a::_ -> return Ok a
} }
let get (discordId : string) : HttpHandler = let get (discordId : string) : HttpHandler =
fun (next : HttpFunc) (ctx : HttpContext) -> fun (next : HttpFunc) (ctx : HttpContext) ->
task { task {
try try
@ -50,8 +50,8 @@ let get (discordId : string) : HttpHandler =
with ex -> with ex ->
return! ServerErrors.internalError (json {| Error = ex.Message |}) next ctx 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) -> fun (next : HttpFunc) (ctx : HttpContext) ->
task { task {
let! body = ctx.BindJsonAsync<{|Amount:int|}>() 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 with ex -> return! RequestErrors.notFound (json {| Error = ex.Message |}) next ctx
| Error e -> return! RequestErrors.notFound (json {| Error = e |}) next ctx | Error e -> return! RequestErrors.notFound (json {| Error = e |}) next ctx
} }
let webApp = let webApp =
choose [ choose [
GET >=> requiresApiKey >=> routef "/user/%s/balance" get GET >=> requiresApiKey >=> routef "/user/%s/balance" get

View File

@ -20,7 +20,6 @@ RUN dotnet publish "CurrencyAPI.fsproj" -c Release -o /app/publish --no-restore
FROM mcr.microsoft.com/dotnet/aspnet:6.0 FROM mcr.microsoft.com/dotnet/aspnet:6.0
WORKDIR /app WORKDIR /app
COPY --from=publish /app/publish . COPY --from=publish /app/publish .
EXPOSE 3333
EXPOSE 80 EXPOSE 80
EXPOSE 443 EXPOSE 443
ENTRYPOINT [ "dotnet", "./CurrencyAPI.App.dll" ] ENTRYPOINT [ "dotnet", "./CurrencyAPI.App.dll" ]