【问题标题】:I want to loop renaming the bot in discord.py rewrite, but its not doing anything when I run something like this我想在 discord.py rewrite 中循环重命名机器人,但是当我运行这样的东西时它什么也没做
【发布时间】:2020-10-09 09:01:53
【问题描述】:

当我运行它时,它不会改变我的机器人的昵称。

latest_names 是一个名称列表。

from discord.ext import commands, tasks
from itertools import cycle

latest_names = andres.get_latest()
namess = cycle(latest_names)

@tasks.loop(seconds=10)
async def change_name():
    await guild.me.edit(nick=next(status))

【问题讨论】:

    标签: discord python-3.7 discord.py itertools


    【解决方案1】:

    您需要调用self.change_name.start() 来启动循环。您应该在 cog 的 init() 函数中执行此操作。

    如果它不在 cog 中,则不要添加 self. 位。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-03-28
      • 2017-11-04
      • 2020-11-19
      • 2021-02-02
      • 2016-01-17
      • 1970-01-01
      相关资源
      最近更新 更多