0

所以基本上我与在线视频扑克(千斤顶或更好)API进行交互,我想创建一个自动为我做出决定的机器人,api请求工作正常,但我希望机器人做出保持/持有的决定给我的 initalHand 卡片,下面是我的代码

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)

基本上让我们举例来说,它返回一个响应,其中 InitalHand 的数据已经绘制了 4 K,我想将这些卡片附加到held: []数组中,let bodyHeld所以我的下一个请求将保留那些 4 K,我正在努力找出我怎么能这样做,任何帮助将不胜感激!, 谢谢 !:)

4

0 回答 0