Awesome IRC bot
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

30 lines
797 B

.. module:: Error
:synopsis: Module to deliberately cause an error for testing handling.
.. moduleauthor:: Dave Pedu <>
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):
"""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)