MyDiceBot - v190610 with KryptoGamers is supported
MyDiceBot - v190610 with KryptoGamers is supported
Feature Update
- KryptoGamers is supported
Source Codes
- UI code
function init() {
console.log('hello KryptoGames Dice');
$$("bet_currency_selection").define("options", [
{id:1,value:"STEEM"},
{id:2,value:"SBD"},
]);
minBetAmount = 0.1;
$$("manual_bet_amount").setValue(minBetAmount);
$$("auto_bet_base_amount").setValue(minBetAmount);
$$("manual_bet_chance").setValue(49);
$$("auto_bet_base_chance").setValue(49);
$$("bet_currency_selection").refresh();
$$("manual_bet_high_button").hide();
$$("auto_bet_start_low_high").define("options", ["LOW"]);
$$("auto_bet_start_low_high").refresh();
}
function checkParams(p,ch){
//console.log(p,ch);
if(p < 0.00000001 || p > 1000000000*1000000000) {
return false
}
if(ch>94 || ch<1) {
return false
}
return true;
}
function initScriptBalance(currencyValue, cb){
getInfo(function(userinfo){
if(userinfo.info.success == 'true'){
try {
balance = userinfo.info.balance;
bets = userinfo.info.bets;
wins = userinfo.info.wins;
losses = userinfo.info.losses;
profit = userinfo.info.profit;
} catch(err){
console.error(err.message);
webix.message({type: 'error', text: err.message});
return false;
}
cb();
}
});
}
function getBalance(userinfo){
balance = userinfo.info.balance
return balance;
}
function getProfit(userinfo){
profit = userinfo.currentInfo.profit;
//console.log('actprofit:'+actProfit);
return profit;
}
function getCurrProfit(ret){
currentprofit = ret.betInfo.profit
//console.log('currprofit:'+currProfit);
return currentprofit;
}
function getCurrentBetId(ret){
let betId = ret.betInfo.id;
//console.log('currentBetId:'+betId);
return betId;
}
function getCurrentRoll(ret){
currentroll = ret.betInfo.roll_number;
//console.log('currentRoll:'+roll);
return currentroll;
}
function outError(ret){
let mess = ret.err;
return checkerr(mess);
}
function isError(ret){
if(typeof ret.err != "undefined")
return false;
else
return true;
}
function getWinStatus(ret){
return ret.betInfo.win;
}
function setDatatable(ret){
let chanceStr = '<font size="3" color="red">'+ ret.betInfo.condition + ' '+ ret.betInfo.target +'</font>';
if(ret.betInfo.win){
chanceStr = '<font size="3" color="green">'+ ret.betInfo.condition + ' '+ ret.betInfo.target +'</font>';
}
let profitStr = '<font size="3" color="red">' + ret.betInfo.profit+ '</font>';
if(ret.betInfo.profit>0) {
profitStr = '<font size="3" color="green">' + ret.betInfo.profit + '</font>';
}
$$('bet_datatable').add({
bet_datatable_id:ret.betInfo.id,
bet_datatable_amount:ret.betInfo.amount,
bet_datatable_low_high:ret.betInfo.condition,
bet_datatable_payout:ret.betInfo.payout,
bet_datatable_bet_chance:chanceStr,
bet_datatable_actual_chance:ret.betInfo.roll_number,
bet_datatable_profit:profitStr,
},0);
}
function setStats(userinfo, cv){
if(userinfo.info.success == 'true'){
$$('bet_total_stats').setValues({
bet_total_stats_balance:userinfo.info.balance,
bet_total_stats_win:userinfo.info.wins,
bet_total_stats_loss:userinfo.info.losses,
bet_total_stats_bet:userinfo.info.bets,
bet_total_stats_profit:userinfo.info.profit,
bet_total_stats_wagered:userinfo.info.wagered,
});
$$('bet_current_stats').setValues({
bet_current_stats_balance:userinfo.currentInfo.balance,
bet_current_stats_win:userinfo.currentInfo.wins,
bet_current_stats_loss:userinfo.currentInfo.losses,
bet_current_stats_bet:userinfo.currentInfo.bets,
bet_current_stats_profit:userinfo.currentInfo.profit,
bet_current_stats_wagered:userinfo.currentInfo.wagered,
});
}
}
* Backend Code
```javascript
'use strict';
import {BaseDice} from './base'
import FormData from 'form-data';
import {APIError} from '../errors/APIError';
import steem from 'steem';
import request from 'request';
import fetch from 'isomorphic-fetch';
export class KryptoGames extends BaseDice {
constructor(){
super();
this.url = 'https://kryptogames.io';
this.benefit = '?ref=mydicebot'
this.currencys = ["steem","sbd"];
steem.api.setOptions({url:'https://api.steemit.com'});
}
async login(userName, password, twoFactor ,apiKey, req) {
req.session.accessToken = apiKey;
req.session.username = userName;
return true;
}
async getUserInfo(req) {
let info = req.session.info;
if(typeof info != 'undefined'){
return true;
}
let userName = req.session.username;
let ret = await steem.api.getAccountsAsync([userName]);
let userinfo = {
'bets' : 0,
'wins' : 0,
'losses' : 0,
'profit' : 0,
'wagered' : 0,
'balance' : 0,
};
for(let k in ret){
let sbd = ret[k]['sbd_balance'].split(' ');
let steem_balance = ret[k]['balance'].split(' ');
userinfo.balance = parseFloat(steem_balance[0]);
}
info = {};
let currentInfo = userinfo;
info.info = userinfo;
req.session.info = info;
console.log(req.session.info);
return info;
}
async refresh(req) {
let info = req.session.info;
if(info){
return info;
}
let userName = req.session.username;
let ret = await steem.api.getAccountsAsync([userName]);
for(let k in ret){
let balance = new Array();
balance['sbd'] = ret[k]['sbd_balance'].split(' ');
balance['steem'] = ret[k]['balance'].split(' ');
info.info.balance = parseFloat(balance[req.query.currency][0]);
}
req.session.info = info;
return info;
}
async clear(req) {
let userName = req.session.username;
let ret = await steem.api.getAccountsAsync([userName]);
let info = {};
info.info = {
'bets' : 0,
'wins' : 0,
'losses' : 0,
'profit' : 0,
'wagered' : 0,
'balance' : 0,
};
info.currentInfo = {
'bets' : 0,
'wins' : 0,
'losses' : 0,
'profit' : 0,
'wagered' : 0,
'balance' : 0,
}
for(let k in ret){
let balance = new Array();
balance['sbd'] = ret[k]['sbd_balance'].split(' ');
balance['steem'] = ret[k]['balance'].split(' ');
info.info.balance = parseFloat(balance[req.query.currency][0]);
info.currentInfo.balance = parseFloat(balance[req.query.currency][0]);
info.info.success = 'true';
}
req.session.info = info;
return info;
}
async bet(req) {
req.setTimeout(500000);
let info = req.session.info;
let amount = (req.body.PayIn/100000000).toFixed(3);
let condition = 'under';
let currency = req.body.Currency.toLowerCase();
let target = 0;
target = Math.floor(req.body.Chance) + 1;
let cseed = Math.random().toString(36).substring(2);
let memo = 'BRoll ' + condition + ' ' + target + ' '+ cseed;
let bet = amount + ' '+ req.body.Currency.toUpperCase();
let userName = req.session.username;
let token = req.session.accessToken;
let kryptoGamesDice = 'kryptogames';
try{
let ret = await this._transfer(token, userName, kryptoGamesDice, bet, memo);
let data = await this._getBetInfo(ret.id, userName, cseed);
if(typeof data._id == "undefined") {
data = await this._getBetInfoFromUser(userName,ret.id, cseed);
}
if(typeof data._id != "undefined") {
data.amount = amount;
let betInfo = {};
betInfo.id = data._id;
betInfo.condition = '<';
betInfo.target = target;
betInfo.profit = (parseFloat(data.payout) - parseFloat(data.amount)).toFixed(8);
betInfo.roll_number = data.diceRoll;
betInfo.payout = parseFloat(data.payout).toFixed(8);
betInfo.amount = parseFloat(data.amount).toFixed(8);
info.info.balance = (parseFloat(info.info.balance) + parseFloat(betInfo.profit)).toFixed(8);
info.currentInfo.balance = (parseFloat(info.currentInfo.balance) + parseFloat(betInfo.profit)).toFixed(8);
info.info.bets++;
info.currentInfo.bets++;
info.info.profit = (parseFloat(info.info.profit) + parseFloat(betInfo.profit)).toFixed(8);
info.info.wagered = (parseFloat(info.info.wagered) + parseFloat(amount)).toFixed(8);
info.currentInfo.wagered = (parseFloat(info.currentInfo.wagered) + parseFloat(amount)).toFixed(8);
info.currentInfo.profit = (parseFloat(info.currentInfo.profit) + parseFloat(betInfo.profit)).toFixed(8);
if(data.won){
betInfo.win = true;
info.info.wins++;
info.currentInfo.wins++;
} else {
betInfo.win = false;
info.info.losses++;
info.currentInfo.losses++;
}
let returnInfo = {};
returnInfo.betInfo= betInfo;
returnInfo.info = info;
req.session.info = info;
return returnInfo;
} else {
throw new Error('bet data is null');
}
} catch(e) {
throw e;
}
}
async _getBetInfoFromUser(account, id, cseed){
let memoRegEx = /\{(.*)/;
return new Promise(async (resolve, reject) => {
try {
let options = {
url: ' https://api.steemit.com',
method: 'POST',
json: {
jsonrpc: '2.0',
method: 'condenser_api.get_account_history',
params: [account, -1, 1],
id: 1
},
timeout:10000
};
for(let tryQueryCount=0; tryQueryCount<20; tryQueryCount++) {
let data = await this._queryUserInfo(options,id,cseed);
if(data !== undefined){
tryQueryCount = 999;
console.log(data);
resolve(data)
} else {
console.log('Waiting for blockchain packing.....');
await this._sleep(15000);
}
}
resolve('not found')
} catch (e) {
reject( e );
}
});
}
async _getBetInfo(id, userName, cseed){
let memoRegEx = /\{(.*)/;
let tryQueryCount = 0;
return new Promise(( resolve, reject ) => {
let release = steem.api.streamOperations(async function (err, op) {
if (err) {
reject( err );
} else {
if (op[0] === "transfer" && op[1].to === userName) {
if (op[1].from === "kryptogames" && op[1].memo.startsWith("You")) {
tryQueryCount++;
try {
memoRegEx = /Client Seed: ([A-Za-z0-9]+),/;
let clientSeed = memoRegEx.exec(op[1].memo)[1] ;
if(clientSeed == cseed ){
release();
let memo = op[1].memo;
let steems = op[1].amount.split(' ');
let data = {};
console.log(memo);
data.payout = steems[0];
data._id = id;
memoRegEx = /Result: ([0-9]+),/;
data.diceRoll = memoRegEx.exec(op[1].memo)[1] ;
data.won = false;
if (memo.indexOf("Won")>0) {
data.won = true;
}
resolve(data);
}
} catch (e) {
reject( e );
}
}
if (op[1].from === "kryptogames" && !op[1].memo.startsWith("You")) {
release();
let memo = op[1].memo;
console.log(memo);
reject(memo);
}
}
}
if(tryQueryCount>=100){
release();
resolve({});
}
});
});
}
async _transfer(p,u,t,s,m){
return new Promise(( resolve, reject ) => {
steem.broadcast.transfer(p, u, t, s, m, function(err, result){
if(err) {
reject( err );
} else {
resolve( result );
}
});
});
}
async _sleep(ms) {
return new Promise(resolve => setTimeout(resolve, ms))
}
async _queryUserInfo(options, id, cseed){
let memoRegEx = /\{(.*)/;
return new Promise(( resolve, reject ) => {
let req = request.post(options,function (e, r, body) {
if(e) {
console.log('reject error');
reject( e );
} else {
if(body) {
let res = body.result;
for(let k in res) {
let tran = res[k][1].op;
try {
if (tran[0] == "transfer" && tran[1].from == "kryptogames" && tran[1].memo.startsWith("You")) {
memoRegEx = /Client Seed: ([A-Za-z0-9]+),/;
let clientSeed = memoRegEx.exec(tran[1].memo)[1] ;
console.log(clientSeed, cseed);
if(clientSeed == cseed ){
let memo = tran[1].memo;
let steems = tran[1].amount.split(' ');
let data = {};
console.log(memo);
data.payout = steems[0];
data._id = id;
memoRegEx = /Result: ([0-9]+),/;
data.diceRoll = memoRegEx.exec(tran[1].memo)[1] ;
data.won = false;
if (memo.indexOf("Won")>0) {
data.won = true;
}
resolve(data);
}
}
} catch (e) {
reject( e );
}
}
}
resolve();
}
});
});
}
}
Online Simulator
Download
- Binaries: https://github.com/mydicebot/mydicebot.github.io/releases
- Source Code: https://github.com/mydicebot/mydicebot.github.io
Supporting Dice Sites (alphabet sequence)
Traditional
Blockchain - STEEM
Quick Start
Download MyDiceBot Binaries here: MyDiceBot Releases.
Different execution methods on different platforms.
Linux (Open Terminal)
chmod +x mydicebot-linux
./mydicebot-linux
Mac (Open Terminal)
chmod +x mydicebot-macos
./mydicebot-macos
Windows (Open Command Prompt)
mydicebot-win.exe
Choose Dice Site, Input username/password/2FA/APIKey, then Login.
Bet and WIN.
Features
- Supported platforms: Windows, Mac, Linux, Web
- Supported programming languages: Lua and Javascript
- Supported multiple dice-sites
- Supported multiple strategies
- New account registration
- Existing account login
- Betting statistics
- Manual bet
- Auto bet
- Script bet (compatible with Seuntjies DiceBot scripts)
Internal Variables
- Single Bet Info
Variable | Type | Permission | Purpose |
---|---|---|---|
basebet | double | Read Write | Shows the amount of the first bet. Only set for first bet. |
previousbet | double | Read Only | Shows the amount of the previous bet. Only set after first bet. |
nextbet | double | Read Write | The amount to bet in the next bet. You need to assign a value to this variable to change the amount bet. Defaults to previousbet after first bet. Needs to be set before betting can start. |
chance | double | Read Write | The chance to win when betting. Defaults to value set in advanced settings if not set. Need to set this value to change the chance to win/payout when betting. |
bethigh | bool | Read Write | Whether to bet high/over (true) or low/under(false). Defaults to true (bet high/bet over) |
win | bool | Read Only | Indicates whether the last bet you made was a winning bet (true) or a losing bet (false). |
currentprofit | double | Read Only | Shows the profit for the last bet made. This is not the amount returned. betting 1 unit at x2 payout, when winning, currentprofit will show 0.00000001 (returned =0.00000002), when losing, profit will show -0.00000001 |
- Current Session Info
Variable | Type | Permission | Purpose |
---|---|---|---|
balance | double | Read Only | Lists your balance at the site you're logged in to. |
bets | int | Read Only | Shows the number of bets for the current session. |
wins | int | Read Only | Shows the number of wins for the current session. |
losses | int | Read Only | Shows the number of losses for the current session. |
profit | double | Read Only | Shows your session profit. Session is defined as the time since opening the current instance of bot or the last time you reset your stats in the bot. |
currentstreak | double | Read Only | Shows the current winning or losing streak. When positive (>0), it's a winning streak. When negative (<0) it's a losing streak. Can never be 0. Only set after first bet. |
currentroll | double | Read Only | Show current roll information |
Internal Functions
Function | Purpose |
---|---|
dobet() | The loop of bets |
stop() | Stop the bet |
Sample Code
- Strategy: Basic Martingale
- Using Lua
chance = 49.5
multiplier = 2
basebet = 0.00000010
bethigh = false
function dobet()
if profit >= 0.1 then
stop()
end
if win then
nextbet = basebet
else
nextbet = previousbet * multiplier
end
end
- Using Javascript
chance = 49.5;
multiplier = 2;
baseBet = 0.00000001;
betHigh = false;
function dobet() {
if (win) {
nextBet = basebet;
} else {
nextBet = previousbet * multiplier;
}
}
Report Issue
License
- GPL-3.0
Thanks
- Special thanks to the open source project of Seuntjies DiceBot.
- If you need simulation functions or advanced-autobet functions, we recommand Seuntjies DiceBot.
Quote
- "Gambling is gambling no matter what you do or how good your strategy is. The house always wins if you keep playing. Winners know when to stop."
- "Like any human, we make mistakes, and like any program, the bot is bound to have a few bugs. Use the bot at your own risk. "
Disclaimer
- This is still gambling. The bot is not guaranteed to win.
- Please do not gamble more than you can afford to lose.
- The bot has a lot of settings, and we cannot test each and every combination.
- The bot might behave unpredictable and unreliably with certain combinations of settings.
- Certain actions from the server might also result in unexpected behavior.
- We cannot be held responsible for any losses incurred while using the bot.
Legal
- It is your obligation to ensure compliance with any legislation relevant to your country of domicile regarding online gambling.
Contact
- github: https://github.com/mydicebot/mydicebot.github.io/issues
- steemit: https://steemit.com/@mydicebot
- bitcointalk: MyDiceBot - Cross-Platform | Multi-Script-Language | Multi-Site | Multi-Strategy
- discord: https://discord.gg/S6W5ec9
Donation
- DOGE: D9wMjdtGqsDZvjxWMjt66JLjE9E9nMAKb7
- steemit: @mydicebot
Thank you for the contribution.
However, the post had the same issues as the last one you published. I appreciate you for always tagging Utopian in your updates. However, I would appreciate if you could make your future posts more descriptive, clear, and informative.
Thanks!
Your contribution has been evaluated according to Utopian policies and guidelines, as well as a predefined set of questions pertaining to the category.
To view those questions and the relevant answers related to your post, click here.
Need help? Chat with us on Discord.
[utopian-moderator]
thanks for reviewing and suggestion.
Thank you for your review, @tykee! Keep up the good work!
great update, for better visibility tag your post with #gambling
@ctime
thanks a lot for your consistent support and suggestion.
updated tag.
Congratulations @mydicebot! You have completed the following achievement on the Steem blockchain and have been rewarded with new badge(s) :
You can view your badges on your Steem Board and compare to others on the Steem Ranking
If you no longer want to receive notifications, reply to this comment with the word
STOP
To support your work, I also upvoted your post!
Vote for @Steemitboard as a witness to get one more award and increased upvotes!
Hi @mydicebot!
Your post was upvoted by @steem-ua, new Steem dApp, using UserAuthority for algorithmic post curation!
Your UA account score is currently 1.533 which ranks you at #37138 across all Steem accounts.
Your rank has dropped 112 places in the last three days (old rank 37026).
In our last Algorithmic Curation Round, consisting of 163 contributions, your post is ranked at #150.
Evaluation of your UA score:
Feel free to join our @steem-ua Discord server
Thank you so much for participating in the Partiko Delegation Plan Round 1! We really appreciate your support! As part of the delegation benefits, we just gave you a 3.00% upvote! Together, let’s change the world!
Hey, @mydicebot!
Thanks for contributing on Utopian.
We’re already looking forward to your next contribution!
Get higher incentives and support Utopian.io!
Simply set @utopian.pay as a 5% (or higher) payout beneficiary on your contribution post (via SteemPlus or Steeditor).
Want to chat? Join us on Discord https://discord.gg/h52nFrV.
Vote for Utopian Witness!