Sending message every minute in discord.py

前端 未结 1 1762
野的像风
野的像风 2021-01-28 09:05

I am trying to make the bot send a message every minute in discord.py. I do acknowledge that this is a easy thing to do but I have tried multiple times but resulting with no luc

相关标签:
1条回答
  • 2021-01-28 09:48

    You try to get channel with get_channel(), but your bot is not ready yet. So you get NoneType object, not channel. Try to this solution:

    @tasks.loop(minutes=1)
    async def test():
        channel = client.get_channel(CHANNEL_ID)
        await channel.send("test")
    
    @client.event
    async def on_ready():
        test.start()
    
    0 讨论(0)
提交回复
热议问题