From acdfbd6593f5cd2fae8a55d57d1511eba0a55095 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Thu, 10 Dec 2015 18:34:25 -0500 Subject: [PATCH] Add pmxbot command --- CHANGES.txt | 5 +++++ setup.py | 3 +++ wolframalpha/pmxbot.py | 10 ++++++++++ 3 files changed, 18 insertions(+) create mode 100644 wolframalpha/pmxbot.py diff --git a/CHANGES.txt b/CHANGES.txt index 8b1a574..7553131 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -1,3 +1,8 @@ +1.4 +=== + +Add pmxbot module and plugin, superseding pmxbot-wolframalpha package. + 1.3 === diff --git a/setup.py b/setup.py index 6e38dc4..6720742 100644 --- a/setup.py +++ b/setup.py @@ -46,6 +46,9 @@ setup_params = dict( "Programming Language :: Python :: 3", ], entry_points={ + 'pmxbot_handlers': [ + 'Wolfram|Alpha = wolframalpha.pmxbot', + ], }, ) if __name__ == '__main__': diff --git a/wolframalpha/pmxbot.py b/wolframalpha/pmxbot.py new file mode 100644 index 0000000..e9bdae0 --- /dev/null +++ b/wolframalpha/pmxbot.py @@ -0,0 +1,10 @@ +# -*- coding: utf-8 -*- +from pmxbot.core import command + +import wolframalpha + +@command("wolframalpha", aliases=('wa',), doc="Wolfram Alpha rules") +def wa(client, event, channel, nick, rest): + client = wolframalpha.Client('Q59EW4-UEL27J79UK') + res = client.query(rest) + return next(res.results).text