Skip to content

Instantly share code, notes, and snippets.

@passcod
Created November 5, 2012 07:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save passcod/4015901 to your computer and use it in GitHub Desktop.
Save passcod/4015901 to your computer and use it in GitHub Desktop.
Proposed library functions for xbot
// Proposed by passcod @ Nov 07 2012 06:47:22
self.attack = function(to) {
var user = to || Object.keys(bot.users)[Math.floor(Object.keys(bot.users).length * Math.random())];
var attack = store.attacks[Math.floor(store.attacks.length * Math.random())];
return attack.replace(/\{defender\}/g, user).replace(/\{attacker\}/g, bot.caller).replace(/{year}/g, Math.round(Math.random() * 10000) + (Math.random() * 100 < 35 ? "BC" : ""));
}
// Proposed by passcod @ Nov 07 2012 07:09:19
self.fish = function(n) {
n = typeof n == 'undefined' ? 1 : n;
return (n < 0) ? "<>< ".repeat(n * -1) : "><> ".repeat(n);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment