【问题标题】:How can I send a direct message to a user after a certain interval in discord.py?如何在 discord.py 中的某个时间间隔后向用户发送直接消息?
【发布时间】:2023-03-06 21:17:01
【问题描述】:

我想发出一个命令,让机器人在某个时间间隔(比如 10 秒)后向消息的作者发送 dm。

【问题讨论】:

    标签: python discord discord.py discord.py-rewrite


    【解决方案1】:

    假设您希望在发送命令后执行此操作:

    import asyncio # for the sleep statement
    
    @bot.command()
    async def messageme(ctx):
        await asyncio.sleep(10)
        await ctx.author.send("This is my DM to you!")
    

    参考资料:

    【讨论】:

      猜你喜欢
      • 2021-11-29
      • 2021-08-22
      • 2017-05-16
      • 2021-04-12
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-11-04
      • 2020-12-25
      相关资源
      最近更新 更多