Right now, I am trying to code an event for a Discord Bot (Using the Discord.py Rewrite package) that would send an image upon certain phrase being sent in the chat.
Based upon the error messages I been having, it looks like it is not passing the Message argument, as it is likely I am missing something somewhere. The Listener seems like it is working as it should be (It triggers the moment someone says something in chat).
Here is the error message I am receiving for reference:
Ignoring exception in message Traceback (most recent call last):
File "C:\Program Files (x86)\Python36-32\lib\site->packages\discord\client.py", line 221, in _run_event await coro(*args, **kwargs) TypeError: dealwithit() missing 1 required >positional argument: 'message'
Here is the code snippet for reference
@bot.event
async def dealwithit(ctx,message):
msg = message.content
msg = msg.lower()
msg = "".join(msg.split())
if ctx.user.id != message.author.id:
if msg == "dealwithit":
dealwithit= discord.File('swag.jpg', filename='swag.jpg')
await client.send_message(content=None,file=dealwithit)
bot.add_listener(dealwithit,'on_message')
Any assistance on what I might be missing that is not passing the arguments over, or have set up incorrectly would be appreciated.
ctx
. And you need to get rid of@bot.event
asdealwithit
isn’t an event name. – abccd