Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/351.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 无法在Discord.py中发送嵌入_Python_Discord_Discord.py - Fatal编程技术网

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')