Dicebot

Jan. 8th, 2008 11:21 pm
rbandrews: (Default)
[personal profile] rbandrews

My GTalk bot (randrewsbot@gmail.com) does something useful now: it rolls dice. I'll make a post later introducing the library and such if people want to write their own, but for now, here's an example bot (minus the parser):

/*extern load */
load('bot-framework.js'); /*extern gtBot */
load('dice.js'); /*extern rollExpression */

var logout=
    gtBot('randrewsbot','mypassword',
	  function(username){
	      return function(line){
		  var result=rollExpression(line);
		  if(result===null){
		      return "I roll dice. Say something like 2d6+1d4-3";
		  }else{
		      return result;
		  }
	      };
	  });

Profile

rbandrews: (Default)
rbandrews

July 2024

S M T W T F S
 123456
78910111213
14151617181920
212223242526 27
28293031   

Style Credit

Page generated Jun. 25th, 2025 07:08 pm
Powered by Dreamwidth Studios

Expand Cut Tags

No cut tags