import { blob } from "https://esm.town/v/std/blob";
import BetSession from "npm:auto-bet-session";
import axios from "npm:axios";
const DEFAULT_PROFIT = 0;
const DEFAULT_BETAMOUNT = 0.00001000;
const DEFAULT_MULTIPLIER = 1.2;
const DEFAULT_OPTION = "higher";
const DEFAULT_INCREASE = 0;
const DEFAULT_COOKIES =
"adbit_session=hs7vl4dc8scoh960t9kmn11g6s5tb8t6;csrf_cookie_name=4dfe584acca70f16d3c3dd934eebed1d;fp=BqPsqYfDkUINYrso";
const VAL_URL = "https://cyrilos-tonpick.web.val.run";
export default async function(req) {
const PLATFORM = "tonpick.game";
var session = new BetSession(PLATFORM, DEFAULT_COOKIES);
var body;
try {
body = await req.json();
}
catch {
body = {
initialBetAmount: DEFAULT_BETAMOUNT,
initialMultiplier: DEFAULT_MULTIPLIER,
currentProfit: DEFAULT_PROFIT,
currentBetAmount: DEFAULT_BETAMOUNT,
currentMultiplier: DEFAULT_MULTIPLIER,
option: DEFAULT_OPTION,
increase: DEFAULT_INCREASE,
winStreak: 0,
lossStreak: 0,
};
}
session.onWin(() => {
if (session.currentProfit >= 500000)
session.resetBetAmount();
});
session.onLoss(() => {
session.increaseBetAmount(100);
});
setTimeout(async () => {
var url = VAL_URL;
var payload = {
initialBetAmount: session.initialBetAmount,
initialMultiplier: session.initialMultiplier,
currentProfit: session.currentProfit,
currentBetAmount: session.currentBetAmount,
currentMultiplier: session.currentMultiplier,
option: session.currentOption,
increase: DEFAULT_INCREASE,
winStreak: session.winStreak,
lossStreak: session.lossStreak,
};
session.stopAutoBet();
await axios({
method: "post",
url: url,
headers: {
"Content-Type": "application/json",
},
data: payload,
})
.then(response => {
console.log(response.data);
})
.catch(err => {
console.log(err);
});
}, 40000);
session.onBet(() => {
if (session.count <= 1) {
session.currentProfit = 0;
session.initialBetAmount = body.initialBetAmount;
session.initialMultiplier = body.initialMultiplier;
session.currentProfit = body.currentProfit;
session.currentBetAmount = body.currentBetAmount;
session.currentMultiplier = body.currentMultiplier;