1 | import urllib2 |
||
2 | from event import Event |
||
3 | try: |
||
4 | from basemodule import BaseModule |
||
5 | except ImportError: |
||
6 | from modules.basemodule import BaseModule |
||
7 | View Code Duplication | class Bofh(BaseModule): |
|
0 ignored issues
–
show
Duplication
introduced
by
![]() |
|||
8 | def post_init(self): |
||
9 | b_event = Event("__.bofh__") |
||
10 | |||
11 | b_event.define(msg_definition="^\.bofh") |
||
12 | b_event.subscribe(self) |
||
13 | |||
14 | self.bot.register_event(b_event, self) |
||
15 | |||
16 | def handle(self, event): |
||
17 | try: |
||
18 | url = "http://zero9f9.com/api/bofh" |
||
19 | response = urllib2.urlopen(url) |
||
20 | text = response.read() |
||
21 | bofhquote = text.splitlines()[2] |
||
22 | self.say(event.channel, "BOFH: " + bofhquote) |
||
23 | except: |
||
24 | pass |
||
25 |