Discord.py bot: how would I make my discord bot send me responses to a command that users use in DMs e.g. for a survey?

前端 未结 2 738
旧巷少年郎
旧巷少年郎 2020-12-12 03:44

So, I want to make my discord bot have a command for a survey where if the user says something like \"#survey\" then the bot will DM them with the question. Then I want to m

2条回答
  •  北海茫月
    2020-12-12 04:11

    @client.event
    async def on_message(message):
        if message.channel.is_private: 
             #If any of the users DM the bot, the bot will send you the message in your DMS
             owner = client.get_member("id_to_send")
             await client.send_message(owner,f"{message.author}": {message.content})
        await client.process_commands(message)
    @client.command(pass_context=True)
    async def survey(ctx):
        await client.send_message(ctx.message.author,"The question you want to ask.")
    

    This could work fine :-)

提交回复
热议问题