问题描述
我正在尝试做一个永久改变颜色的角色。我正在使用discord.py重写。
几个小时前它可以正常工作了,我感到困惑,因为它不再存在了。我什么都没改变。
这是我的代码:
import discord
import asyncio
from discord.ext import commands
bot = commands.Bot(command_prefix='?',description="description")
@bot.event
async def on_ready():
print('Logged in as')
print(bot.user.name)
print(bot.user.id)
print('------')
@bot.command()
async def rgb(ctx,time: int):
colours = [0xFF0000,0x00FF00,0x0000FF]
i = 0
selectedrole = ctx.guild.get_role(748128282859274251)
while True:
i = (i + 1) % 3
print("This is printed")
await selectedrole.edit(colour=discord.Colour(colours[i]))
print("This will not be printed")
await asyncio.sleep(time)
bot.run('xxxxx')
它不会运行这一行代码而只是停止(程序仍在运行,什么也没发生)
等待selectedrole.edit(colour = discord.Colour(colours [i]))
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)