So basically im interacting with an online Video Poker(jacks or better) API, and i want to create an bot that automatically take decisions for me, the api requests are working fine, but i want the bot to take the decision of keep/helding the cards of the initalHand for me, following there is my code
let bodyReq = {variables:{currency:currency,amount:betAmount},query: "mutation VideoPokerBet($amount: Float!, $currency: CurrencyEnum!) {\n videoPokerBet(amount: $amount, currency: $currency) {\n ...CasinoBet\n state {\n ...CasinoGameVideoPoker\n }\n }\n}\n\nfragment CasinoBet on CasinoBet {\n id\n active\n payoutMultiplier\n amountMultiplier\n amount\n payout\n updatedAt\n currency\n game\n user {\n id\n name\n }\n}\n\nfragment CasinoGameVideoPoker on CasinoGameVideoPoker {\n playerHand {\n suit\n rank\n }\n initialHand {\n suit\n rank\n }\n handResult\n}\n"}
let bodyHeld = {variables:{identifier:identifier,held:[]},query: "mutation VideoPokerNext($held: [VideoPokerNextHeldInput!]!, $identifier: String!) {\n videoPokerNext(held: $held, identifier: $identifier) {\n ...CasinoBet\n state {\n ...CasinoGameVideoPoker\n }\n }\n}\n\nfragment CasinoBet on CasinoBet {\n id\n active\n payoutMultiplier\n amountMultiplier\n amount\n payout\n updatedAt\n currency\n game\n user {\n id\n name\n }\n}\n\nfragment CasinoGameVideoPoker on CasinoGameVideoPoker {\n playerHand {\n suit\n rank\n }\n initialHand {\n suit\n rank\n }\n handResult\n}\n"}
async function vpokerBet() {
try{
running.style.color = "lightgreen"
let respData;
while(true) {
respData = await (await fetch(url, {
method: "POST",
headers: {
"Content-Type": "application/json",
"Accept": "application/json",
"x-access-token": apikey,
},
body: JSON.stringify(
bodyReq
)
})).json()
do{
respData = await (await fetch(url, {
method: "POST",
headers: {
"Content-Type": "application/json",
"Accept": "application/json",
"x-access-token": apikey,
},
body: JSON.stringify(
bodyHeld
)
})).json()}while(respData.data.videoPokerBet.active == true)
Basically Lets say for Example it returns an response in which the data of the InitalHand has drawn 4 K's , i want to append those cards to the held: [] Array in let bodyHeld so my next request will have keep those 4 K's, im struggling to finding out how i can do it, any help would be much appreciated ! , thanks ! :)