Problem
I wanted to use multiple listener in a cog file in discord.py but it wont work. Only the last listener in the code gets called. How to solve it?
Code
class test(commands.Cog):
@commands.Cog.listener()
async def on_message(self, message):
# code of this function
@commands.Cog.listener()
async def on_message(self, message):
# code of this function
def setup(bot):
bot.add_cog(test(bot))
class test(commands.Cog):
@commands.Cog.listener("on_message")
async def listener_one(self, message):
# code of this function
@commands.Cog.listener("on_message")
async def listener_two(self, message):
# code of this function
def setup(bot):
bot.add_cog(test(bot))