| Total Complexity | 3 |
| Total Lines | 18 |
| Duplicated Lines | 0 % |
| 1 | import urllib2 |
||
| 7 | class Bofh(BaseModule): |
||
| 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 |