Python 无法在Discord.py中发送嵌入
这是我的代码:Python 无法在Discord.py中发送嵌入,python,discord,discord.py,Python,Discord,Discord.py,这是我的代码: @客户端事件 异步def on_消息(消息): 如果message.content.startswith('.announce'): first_embed=discord.embed(title=“Enter announcement”,color=0x2bff00) msgg=wait message.channel.send(嵌入=first\u嵌入) def检查(m): 返回m.channel==message.channel msg=wait client.wait_
@客户端事件
异步def on_消息(消息):
如果message.content.startswith('.announce'):
first_embed=discord.embed(title=“Enter announcement”,color=0x2bff00)
msgg=wait message.channel.send(嵌入=first\u嵌入)
def检查(m):
返回m.channel==message.channel
msg=wait client.wait_for('message',check=check)
ann=msg.content
印刷品(安)
时间。睡眠(10)
新建_embed=discord.embed(title='Enter color(红、绿、黄)',color=0x2bff00)
等待msgg.edit(嵌入=新嵌入)
def检查(m):
返回m.channel==message.channel
msg=wait client.wait_for('message',check=check)
colo=msg.content
印刷品(科洛)
通道=客户端。获取_通道(733344357884756018)
如果(colo=='Red'):
颜色(0xFF0000)
如果(colo==“绿色”):
颜色(0x2bff00)
如果(colo==“黄色”):
颜色(0xFFFF00)
wait channel.send(discord.Embed(title=ann,color=coloo))
client.run('TOKEN')
您需要使用.send(embed=discord.embed)
这是更新后的代码-
@client.event
async def on_message(message):
if message.content.startswith('.announce'):
first_embed = discord.Embed(title="Enter announcement", color=0x2bff00)
msgg = await message.channel.send(embed=first_embed)
def check(m):
return m.channel == message.channel
msg = await client.wait_for('message', check=check)
ann = msg.content
print(ann)
time.sleep(10)
new_embed = discord.Embed(title='Enter Colour(Red, Green, Yellow)', color=0x2bff00)
await msgg.edit(embed=new_embed)
def check(m):
return m.channel == message.channel
msg = await client.wait_for('message', check=check)
colo = msg.content
print(colo)
channel = client.get_channel(733344357884756018)
if(colo=='Red'):
coloo = discord.Colour(0xFF0000)
if(colo == 'Green'):
coloo = discord.Colour(0x2bff00)
if(colo == 'Yellow'):
coloo = discord.Colour(0xFFFF00)
await channel.send(embed=discord.Embed(title=ann, color=coloo))
client.run('TOKEN')