pyircbot/pyircbot/modules/Error.py

29 lines
737 B
Python
Raw Normal View History

"""
.. module:: Error
:synopsis: Module to deliberately cause an error for testing handling.
.. moduleauthor:: Dave Pedu <dave@davepedu.com>
"""
#!/usr/bin/env python
2015-06-18 19:37:08 -07:00
from pyircbot.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"""
if "error" in trailing:
print(10/0)