擅长:python、mysql、java
<p>实现这一点的<a href="/questions/tagged/discord.py" class="post-tag" title="show questions tagged 'discord.py'" rel="tag">discord.py</a>方法是使用<code>discord.ext.tasks</code>扩展将<code>reccurship</code>转换为<a href="https://discordpy.readthedocs.io/en/latest/ext/tasks/index.html" rel="nofollow noreferrer">task</a></p>
<pre><code>from discord.ext import tasks, commands
bot = commands.Bot("!")
@bot.event
async def on_message(message):
...
@tasks.loop(hours=1)
async def reccurship():
...
@reccurship.before_loop
async def before_reccurship():
await bot.wait_until_ready()
recurrship.start()
bot.run("token")
</code></pre>