Bitcoin Forum
December 10, 2016, 02:57:34 PM *
News: Latest stable version of Bitcoin Core: 0.13.1  [Torrent].
 
   Home   Help Search Donate Login Register  
Pages: [1]
  Print  
Author Topic: Bitcoin IRC Bot  (Read 2138 times)
anthony_
Member
**
Offline Offline

Activity: 65


View Profile
June 15, 2011, 01:14:11 PM
 #1

Anyways, basically I have been working on my bitcoin bot all night, it does this right now like !btcstats and !mktstats <market_symbol>.

It's unique feature at the moment is it's gambling feature, it follows a very similar design to the bitcoinlotto posted earlier where:
1-50 loses to the pot
51-89 wins 170% of the wager
90-100 wins 220% of the wager

If you submit over 0.1 BTC as a wager, you have a chance to win 75% of the pot, the other 25% is reserved for fees and such.


Anyways, if you wanted to give it a shot you can find him in #btcbot on irc.freenode.net.

Here is the source for the gambling feature:
Code:
$bitcoin = new jsonRPCClient('');
$balance = floatval($bitcoin->getbalance("pot", 1));

switch($args[1]) {
case "pot_balance":
$bot->message($chan, $who[0] . ", Pot balance is: " . $balance);
break;
case "balance":
$bot->message($chan, $who[0] . ", Your balance is: " . $bitcoin->getbalance($who[0], 1));
break;
case "newaddress":
$bot->message($chan, $who[0] . ", Your new address is: " . $bitcoin->getnewaddress($who[0]));
break;
case "withdraw":
if(!$args[2]) {
$bot->message($chan, $who[0] . ", use !btcdouble withdraw <sendtoaddress>");
return 0;
}
$balance_you = $bitcoin->getbalance($who[0], 1);
$bot->message($chan, $who[0] . ", You have been sent: " . $balance_you);
$bitcoin->sendfrom("pot", $args[2], $balance_you, 1);
break;

case "roll":
if(!$args[2]) {
$bot->message($chan, $who[0] . ", use !btcdouble roll <wager>");
return 0;
}
$wager = floatval($args[2]);
if($bitcoin->getbalance($who[0], 1) < $wager || $wager < 0) {
$bot->message($chan, $who[0] . ", you cannot wager that amount!!!");
return 0;
}
$num = rand(1,100);
if ($num <= 50) {
$bitcoin->move($who[0], "pot", $wager, 0);
$bot->message($chan, $who[0] . ", You rolled a  " . $num . ", " . $wager . " BTC has been sent to the pot");
} elseif($num > 50 && $num < 90) {
$bitcoin->move($who[0], "pot", $wager, 0);
if(($balance + 0.0005) < $wager*1.7) {
$myFile = "debt";
$fh = fopen($myFile, 'a');
$stringData = "Owe " .$wager*1.7. " to " . $who[0] . "\n";
fwrite($fh, $stringData);
fclose($fh);
$bot->message($chan, $who[0] . ", You rolled a  " . $num . " but the pot is unable to pay you off at the moment, contact bool_ and tell him to send you your winnings.");
return 0;
}
$bitcoin->move("pot", $who[0], $wager*1.7, 0);
$bot->message($chan, $who[0] . ", You rolled a  " . $num . ", " . ($wager*1.7) . " BTC has been sent to your balance");
} else {
$bitcoin->move($who[0], "pot", $wager, 0);
if(($balance + 0.0005) < $wager*2.2) {
$myFile = "debt";
$fh = fopen($myFile, 'a');
$stringData = "Owe " .$wager*2.2. " to " . $who[0] . "\n";
fwrite($fh, $stringData);
fclose($fh);
$bot->message($chan, $who[0] . ", You rolled a  " . $num . " but the pot is unable to pay you off at the moment, contact bool_ and tell him to send you your winnings.");
return 0;
}
$bitcoin->move("pot", $who[0], $wager*2.2, 0);
$bot->message($chan, $who[0] . ", You rolled a  " . $num . ", " . ($wager*2.2) . " BTC has been sent to your balance");
}
break;
default:
$bot->message($chan, $who[0] . ", use !btcdouble <roll|withdraw|newaddress|balance|pot_balance>");
break;
}
1481381854
Hero Member
*
Offline Offline

Posts: 1481381854

View Profile Personal Message (Offline)

Ignore
1481381854
Reply with quote  #2

1481381854
Report to moderator
1481381854
Hero Member
*
Offline Offline

Posts: 1481381854

View Profile Personal Message (Offline)

Ignore
1481381854
Reply with quote  #2

1481381854
Report to moderator
1481381854
Hero Member
*
Offline Offline

Posts: 1481381854

View Profile Personal Message (Offline)

Ignore
1481381854
Reply with quote  #2

1481381854
Report to moderator
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction. Advertise here.
1481381854
Hero Member
*
Offline Offline

Posts: 1481381854

View Profile Personal Message (Offline)

Ignore
1481381854
Reply with quote  #2

1481381854
Report to moderator
bitlotto
Hero Member
*****
Offline Offline

Activity: 672


BitLotto - best odds + best payouts + cheat-proof


View Profile WWW
June 17, 2011, 04:28:41 AM
 #2

How do we verify the bot? Will it list all transactions so we can see if it matches what is expected?

*Next Draw Feb 1*  BitLotto: monthly raffle (0.25 BTC per ticket) Completely transparent and impossible to manipulate who wins. TOR
TOR2WEB
Donations to: 1JQdiQsjhV2uJ4Y8HFtdqteJsZhv835a8J are appreciated.
anthony_
Member
**
Offline Offline

Activity: 65


View Profile
June 18, 2011, 05:08:01 AM
 #3

How do we verify the bot? Will it list all transactions so we can see if it matches what is expected?

Uhm, right now you can't, I'd be able to add it in the future though if it's needed.
Pages: [1]
  Print  
 
Jump to:  

Sponsored by , a Bitcoin-accepting VPN.
Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!