diff --git a/modules/wolfgame.py b/modules/wolfgame.py index e00e3f6..e1eeac0 100644 --- a/modules/wolfgame.py +++ b/modules/wolfgame.py @@ -3598,6 +3598,20 @@ def transition_day(cli, gameid=0): "https://i.imgur.com/b8HAvjL.gifv", "https://i.imgur.com/PIIfL15.gifv"] )) + elif random.random() < var.FORTUNE_CHANCE: + try: + out = subprocess.check_output(("fortune", "-s")) + except OSError as e: + if e.errno != 2: + # No such file or directory (fortune is not installed) + raise + else: + out = out.decode("utf-8", "replace") + out = out.replace("\n", " ") + # Replace tabs and multiple spaces with a single space. + out = re.sub(r"\s+", " ", out) + + message.append(out) if victim in var.HVISITED.values() and victim in bywolves: # victim was visited by some harlot and victim was attacked by wolves for hlt in var.HVISITED.keys(): diff --git a/settings/wolfgame.py b/settings/wolfgame.py index 28c2ccb..abb5a8a 100644 --- a/settings/wolfgame.py +++ b/settings/wolfgame.py @@ -240,6 +240,7 @@ QUIT_MESSAGES_NO_REVEAL = ("\u0002{0}\u0002 suddenly falls over dead before the "\u0002{0}\u0002 suddenly bursts into flames and is now all but a memory.") GIF_CHANCE = 1/50 +FORTUNE_CHANCE = 1/25 import botconfig import fnmatch