【发布时间】:2020-09-09 10:10:35
【问题描述】:
这是我的代码:
@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(discord.Embed(title=ann, color=coloo))
client.run('TOKEN')
不幸的是,当我运行程序时,它会正确获取输入和一切,但输出结果是:
我想要达到的目标:
基本上要在我的服务器中发送嵌入公告,因为它看起来很漂亮哈哈。
任何帮助解决这个问题或改进我的代码将不胜感激:)
图片:
【问题讨论】:
标签: python discord discord.py