module Degenz.RockPaperScissors open System open System.Threading.Tasks open DSharpPlus open DSharpPlus.Entities open DSharpPlus.SlashCommands open Degenz.Messaging type Move = | Rock | Paper | Scissor type RoundResult = | P1Win | P2Win | Draw let player1Won p1m p2m = match p1m , p2m with | Rock , Paper -> P2Win | Rock , Scissor -> P1Win | Paper , Rock -> P1Win | Paper , Scissor -> P2Win | Scissor , Rock -> P2Win | Scissor , Paper -> P1Win | _ , _ -> Draw let playRPS target ctx = Game.executePlayerActionWithTarget target ctx (fun attacker defender -> async { return () }) type StealGame() = inherit ApplicationCommandModule () let enforceChannel (ctx : IDiscordContext) (storeFn : IDiscordContext -> Task) = match ctx.GetChannel().Id with | id when id = GuildEnvironment.channelArmory -> storeFn ctx | _ -> task { let msg = $"You must go to <#{GuildEnvironment.channelArmory}> channel to buy or sell weapons" do! Messaging.sendSimpleResponse ctx msg } [] member this.RPS (ctx : InteractionContext, [] target : DiscordUser) = // enforceChannel (DiscordInteractionContext ctx) (steal target) playRPS target (DiscordInteractionContext ctx)