Answers for "how to check if a message is a command discord.py"

2

check if message is in dm discord.py

@client.command()
async def check(ctx):
    if ctx.channel.type == discord.ChannelType.private:
        await ctx.send("Message is in dm")
    else:
      	await ctx.send("Message is not in dm")

# watch cocomelon :)
Posted by: Guest on November-01-2021
2

how to check if a message includes a word discord.py

@bot.event
async def on_message(msg):
    if 'word' in msg.content:
        print('Keyword found')
        # Do stuff here
Posted by: Guest on January-25-2021
1

discord.py message user

if message.content == "dm":
        await message.channel.send("Dming user")
        dm = await message.author.create_dm()  # Creates a dm channel with the user
        await dm.send("What you want to send")  # Sends the user the message
Posted by: Guest on March-08-2021

Code answers related to "how to check if a message is a command discord.py"

Python Answers by Framework

Browse Popular Code Answers by Language