blob: b16671bcdea3b4af53960c906ae96fd5865a47a9 (
about) (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
#--depends-on commands
import urllib.parse
from src import ModuleManager, utils
EVAL_URL = "http://dotpy3.herokuapp.com/"
class Module(ModuleManager.BaseModule):
_name = "Python"
@utils.hook("received.command.py", alias_of="python")
@utils.hook("received.command.python")
def _eval(self, event):
url = "%s?%s" % (EVAL_URL, urllib.parse.quote(event["args"]))
page = None
try:
page = utils.http.request(url)
except:
pass
if page and page.data:
event["stdout"].write("%s: %s" % (event["user"].nickname,
page.data.rstrip("\n")))
else:
event["stderr"].write("%s: failed to eval" % event["user"].nickname)
|