30 lines
1.1 KiB
Forth
30 lines
1.1 KiB
Forth
module Degenz.Game
|
|
|
|
open System.Threading.Tasks
|
|
open DSharpPlus.EventArgs
|
|
open DSharpPlus.SlashCommands
|
|
open Degenz.DbService
|
|
|
|
let HackPrize = 10<GBT>
|
|
let ShieldPrize = 5<GBT>
|
|
|
|
let executePlayerInteraction (ctx : InteractionContext) (dispatch : PlayerData -> Async<unit>) =
|
|
async {
|
|
let! playerResult = tryFindPlayer ctx.Member.Id
|
|
match playerResult with
|
|
| Some player -> do! dispatch player
|
|
| None -> do! Messaging.sendSimpleResponse ctx "You are currently not a hacker, first use the /redpill command to become one"
|
|
} |> Async.StartAsTask
|
|
:> Task
|
|
|
|
// TODO: Create an abstraction for these two helper functions
|
|
let executePlayerEvent (ctx : ComponentInteractionCreateEventArgs) (dispatch : PlayerData -> Async<unit>) =
|
|
async {
|
|
let! playerResult = tryFindPlayer ctx.User.Id
|
|
match playerResult with
|
|
| Some player -> do! dispatch player
|
|
| None -> do! Messaging.sendInteractionEvent ctx "You are currently not a hacker, first use the /redpill command to become one"
|
|
} |> Async.StartAsTask
|
|
:> Task
|
|
|