# Path: cardinal/decorators.py
# def command(triggers):
#     if isinstance(triggers, str):
#         triggers = [triggers]
# 
#     if not isinstance(triggers, list):
#         raise TypeError("Command must be a trigger string or list of triggers")
# 
#     def wrap(f):
#         f.commands = triggers
#         return f
# 
#     return wrap
# 
# def help(lines):
#     # For backwards compatibility
#     if isinstance(lines, str):
#         lines = [lines]
# 
#     if not isinstance(lines, list):
#         raise TypeError("Help must be a help string or list of help strings")
# 
#     def wrap(f):
#         # Create help list or prepend to it
#         if not hasattr(f, 'help'):
#             f.help = lines
#         else:
#             f.help = lines + f.help
# 
#         return f
# 
#     return wrap
# 
# def regex(expression):
#     if (not isinstance(expression, str) and
#             not isinstance(expression, _RETYPE)):
#         raise TypeError("Regular expression must be a string or regex type")
# 
#     def wrap(f):
#         f.regex = expression
#         return f
# 
#     return wrap


from cardinal.decorators import command, help, regex


class PingPlugin:
    @regex(r'(?i)^ping[.?!]?$')
    @command(['ping'])
    @help("Responds to a ping message with 'Pong.'")
    def pong(self, cardinal, user, channel, msg):
        if channel != user:
            cardinal.sendMsg(channel, "%s: Pong." % user.nick)

# Path: cardinal/decorators.py
# def command(triggers):
#     if isinstance(triggers, str):
#         triggers = [triggers]
# 
#     if not isinstance(triggers, list):
#         raise TypeError("Command must be a trigger string or list of triggers")
# 
#     def wrap(f):
#         f.commands = triggers
#         return f
# 
#     return wrap
# 
# def help(lines):
#     # For backwards compatibility
#     if isinstance(lines, str):
#         lines = [lines]
# 
#     if not isinstance(lines, list):
#         raise TypeError("Help must be a help string or list of help strings")
# 
#     def wrap(f):
#         # Create help list or prepend to it
#         if not hasattr(f, 'help'):
#             f.help = lines
#         else:
#             f.help = lines + f.help
# 
#         return f
# 
#     return wrap
# 
# def regex(expression):
#     if (not isinstance(expression, str) and
#             not isinstance(expression, _RETYPE)):
#         raise TypeError("Regular expression must be a string or regex type")
# 
#     def wrap(f):
#         f.regex = expression
#         return f
# 
#     return wrap


# Path: plugins/ping/plugin.py
from cardinal.decorators import command, help, regex



class PingPlugin:
    @regex(r'(?i)^ping[.?!]?$')
    @command(['ping'])
    @help("Responds to a ping message with 'Pong.'")
    def pong(self, cardinal, user, channel, msg):
        if channel != user:
            cardinal.sendMsg(channel, "%s: Pong." % user.nick)

        else: