mirror of
https://github.com/Rapptz/discord.py.git
synced 2025-04-21 00:07:51 +00:00
parent
bbc4460c38
commit
757584e651
@ -102,7 +102,8 @@ class CogMeta(type):
|
||||
except AttributeError:
|
||||
continue
|
||||
else:
|
||||
listeners.append((value.__cog_listener_name__, value.__name__))
|
||||
for name in value.__cog_listener_names__:
|
||||
listeners.append((name, value.__name__))
|
||||
|
||||
attrs['__cog_commands__'] = commands # this will be copied in Cog.__new__
|
||||
attrs['__cog_listeners__'] = tuple(listeners)
|
||||
@ -209,7 +210,11 @@ class Cog(metaclass=CogMeta):
|
||||
if not inspect.iscoroutinefunction(func):
|
||||
raise TypeError('Listener function must be a coroutine function.')
|
||||
func.__cog_listener__ = True
|
||||
func.__cog_listener_name__ = name or func.__name__
|
||||
to_assign = name or func.__name__
|
||||
try:
|
||||
func.__cog_listener_names__.append(to_assign)
|
||||
except AttributeError:
|
||||
func.__cog_listener_names__ = [to_assign]
|
||||
return func
|
||||
return decorator
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user