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
|> (*) 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<GBT>
else attacker.Bank , 0<GBT>
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() =
[<SlashCommand("scan", "Find 5 targets connected to the network we can try to hack")>]
member this.ScanCommand (ctx : InteractionContext) =
enforceChannels (DiscordInteractionContext ctx) scan scan
// [<SlashCommand("test-autocomplete", "Create a passive defense that will last 24 hours")>]
member this.TestAutoComplete (ctx : InteractionContext) =
async {
@ -377,4 +377,4 @@ type HackerGame() =
do! ctx.Interaction.CreateResponseAsync(InteractionResponseType.ChannelMessageWithSource, builder)
|> Async.AwaitTask
} |> Async.StartAsTask
:> Task
:> Task

View File

@ -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

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
WORKDIR /app
COPY --from=publish /app/publish .
EXPOSE 3333
EXPOSE 80
EXPOSE 443
ENTRYPOINT [ "dotnet", "./CurrencyAPI.App.dll" ]