![](/img/trans.png)
[英]I am making relationships from a dictionary, but can someone help me fix one output I can't figure out?
[英]When I have two different embed commands with different urls only one of them will work- Can someone help figure this out for me?
@client.event async def on_message(message): if message.content.startswith('!axb'): embed = discord.Embed(title="Axb :sparkles:", description="9b9t Bot Dev", color=0xf188c9) embed.set_image(url='insert url') await message.channel.send(embed=embed) @client.event async def on_message(message): if message.content.startswith('!opal'): embed = discord.Embed(title="opal :sparkles:", description="9b9t Bot Dev", color=0xf188c9) embed.set_image(url='insert url') await message.channel.send(embed=embed)
只有最后一個on_message
事件會起作用,為什么不使用簡單的 elif 語句呢?
@client.event
async def on_message(message):
if message.content.startswith('!axb'):
embed = discord.Embed(title="Axb :sparkles:", description="9b9t Bot Dev", color=0xf188c9)
embed.set_image(url='insert url')
await message.channel.send(embed=embed)
elif message.content.startswith('!opal'):
embed = discord.Embed(title="opal :sparkles:", description="9b9t Bot Dev", color=0xf188c9)
embed.set_image(url='insert url')
await message.channel.send(embed=embed)
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.