From 864dc8d39a055a24d6e91ec5d1899a21ad50ae2d Mon Sep 17 00:00:00 2001 From: iou1name Date: Thu, 24 May 2018 22:27:16 -0400 Subject: [PATCH] added fortune.py --- modules/fortune.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 modules/fortune.py diff --git a/modules/fortune.py b/modules/fortune.py new file mode 100644 index 0000000..af9e2ad --- /dev/null +++ b/modules/fortune.py @@ -0,0 +1,16 @@ +#!/usr/bin/env python3 +""" +Runs the command "fortune -a" and sends the output to channel. +""" +import subprocess + +from module import commands + +@commands("fortune", "fort") +def fortune(bot, trigger): + """ + print a random, hopefully interesting, adage + """ + res = subprocess.check_output(["fortune", "-a"]) + res = res.decode("utf-8").replace("\t", " ") + bot.msg(res)