diff options
Diffstat (limited to 'modules/random_number.py')
| -rw-r--r-- | modules/random_number.py | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/modules/random_number.py b/modules/random_number.py index 6fec2b25..51acb5a0 100644 --- a/modules/random_number.py +++ b/modules/random_number.py @@ -1,6 +1,8 @@ import random, uuid from src import ModuleManager, utils +COIN_SIDES = ["heads", "tails"] + class Module(ModuleManager.BaseModule): _name = "Random" @@ -29,6 +31,12 @@ class Module(ModuleManager.BaseModule): event["stderr"].write( "Both start and end must be valid integers") + @utils.hook("received.command.cointoss") + def coin_toss(self, event): + chosen_side = random.SystemRandom().choice(COIN_SIDES) + event["stdout"].write("%s tosses a coin and gets %s" % + (event["user"].nickname, chosen_side)) + @utils.hook("received.command.uuid") def uuid(self, event): """ |
