pyircbot/pyircbot/modules/Error.py

30 lines
797 B
Python
Raw Normal View History

2017-01-01 14:59:01 -08:00
"""
.. module:: Error
2015-11-01 18:03:11 -08:00
:synopsis: Module to deliberately cause an error for testing handling.
.. moduleauthor:: Dave Pedu <dave@davepedu.com>
"""
2017-01-01 14:59:01 -08:00
from pyircbot.modulebase import ModuleBase, ModuleHook
class Error(ModuleBase):
2015-11-01 18:03:11 -08:00
def __init__(self, bot, moduleName):
ModuleBase.__init__(self, bot, moduleName)
2017-01-01 14:59:01 -08:00
self.hooks = [ModuleHook("PRIVMSG", self.error)]
2015-11-01 18:03:11 -08:00
def error(self, args, prefix, trailing):
"""If the message recieved from IRC has the string "error" in it, cause a ZeroDivisionError
2017-01-01 14:59:01 -08:00
2015-11-01 18:03:11 -08:00
: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:
2017-01-01 14:59:01 -08:00
print(10 / 0)