【发布时间】:2020-12-05 09:38:56
【问题描述】:
我正在尝试让我的机器人自动更改其不和谐状态,但它更改为 <itertools.cycle object at 0x03EA9488>
这一切都在一个齿轮中,没有状态更改代码,它工作得非常好。我没有收到任何错误。
这是我正在使用的代码:
import discord
from discord.ext import commands, tasks
from itertools import cycle
status = cycle(['status 1', 'status 2', 'status 3'])
class OnReady(commands.Cog):
def __init__(self, client):
self.client = client
@tasks.loop(seconds=10)
async def change_status(self):
await self.client.change_presence(status=discord.Status.idle, activity=discord.Game(status))
@commands.Cog.listener()
async def on_ready(self):
self.change_status.start()
print('Bot is online.')
def setup(client):
client.add_cog(OnReady(client))
感谢任何帮助。谢谢。
【问题讨论】:
标签: python discord discord.py