What I'm trying to do: To receive a response from the message author in their DMs with the bot.
My problem: Bot does not respond when message is sent to it in the DMs as I am expecting. There are no error messages.
Code:
@client.command()
async def test(ctx):
await ctx.send("Sending a dm now")
def check(message):
return message.author == ctx.author and message.channel == discord.channel.DMChannel
try:
await ctx.author.send("Say test: ")
response = await client.wait_for('message', check=check)
if response.content.lower() == 'test':
await ctx.send("Test successful")
elif response.content.lower() == 'banana':
await ctx.author.send("That works too")
except:
# do things here
Images:
(Above image) No response is given despite the given conditions being met.
References/ Other Questions I have referred to:
message.channel == discord.channel.DMChannel
is what is causing you the problem. – Fluffy