Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

use an async check function for discord.py wait_for?

import asyncio

@client.command()
async def test(ctx):

    async def run(msg):
        await msg.send("This message is not yours!", hidden=True)
        return


    def check(msg):

        if msg.author.id == ctx.author.id:
            return True
        else:
            asyncio.create_task(run(msg))
            return False

    ctx = await client.wait_for("message", check=check)

    ...
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #async #check #function
ADD COMMENT
Topic
Name
9+4 =