@classmethod<EOL><INDENT>def listener(cls, name=None):<DEDENT>
if name is not None and not isinstance(name, str):<EOL><INDENT>raise TypeError('<STR_LIT>'.format(name))<EOL><DEDENT>def decorator(func):<EOL><INDENT>actual = func<EOL>if isinstance(actual, staticmethod):<EOL><INDENT>actual = actual.__func__<EOL><DEDENT>if not inspect.iscoroutinefunction(actual):<EOL><INDENT>raise TypeError('<STR_LIT>')<EOL><DEDENT>actual.__cog_listener__ = True<EOL>to_assign = name or actual.__name__<EOL>try:<EOL><INDENT>actual.__cog_listener_names__.append(to_assign)<EOL><DEDENT>except AttributeError:<EOL><INDENT>actual.__cog_listener_names__ = [to_assign]<EOL><DEDENT>return func<EOL><DEDENT>return decorator<EOL>
A decorator that marks a function as a listener.

        This is the cog equivalent of :meth:`.Bot.listen`.

        Parameters
        ------------
        name: :class:`str`
            The name of the event being listened to. If not provided, it
            defaults to the function's name.

        Raises
        --------
        TypeError
            The function is not a coroutine function or a string was not passed as
            the name.