2014-10-02 14:48:59 -07:00
|
|
|
"""
|
|
|
|
.. module:: Error
|
|
|
|
:synopsis: Module to deliberately cause an error for testing handling.
|
|
|
|
|
|
|
|
.. moduleauthor:: Dave Pedu <dave@davepedu.com>
|
|
|
|
|
|
|
|
"""
|
|
|
|
|
2014-09-09 20:06:03 -07:00
|
|
|
#!/usr/bin/env python
|
|
|
|
from modulebase import ModuleBase,ModuleHook
|
|
|
|
|
|
|
|
class Error(ModuleBase):
|
|
|
|
def __init__(self, bot, moduleName):
|
|
|
|
ModuleBase.__init__(self, bot, moduleName)
|
|
|
|
self.hooks=[ModuleHook("PRIVMSG", self.error)]
|
|
|
|
|
|
|
|
def error(self, args, prefix, trailing):
|
2014-10-02 16:53:54 -07:00
|
|
|
"""If the message recieved from IRC has the string "error" in it, cause a ZeroDivisionError
|
|
|
|
|
|
|
|
:param args: IRC args received
|
|
|
|
:type args: list
|
|
|
|
:param prefix: IRC prefix of sender
|
|
|
|
:type prefix: str
|
|
|
|
:param trailing: IRC message body
|
|
|
|
:type trailing: str"""
|
2014-09-09 20:06:03 -07:00
|
|
|
if "error" in trailing:
|
|
|
|
print(10/0)
|
|
|
|
|