...on_message():
channel = message.channel
embed = discord.Embed(title=f"**Ok {member_name}**", description=f"Command cancelled. You might get better results with a second read.\n\nOr please see {info_chan} under 'Updating Stats' for other update options.", color=0xcc79a7)
await channel.send(embed=embed)由于某些原因,这不起作用。我在其他on_message if语句中也有相同的代码,它们可以完美地工作
发布于 2020-12-21 02:22:12
我想我能帮到你!
您的on_message似乎没有被发送,因为您在创建事件时忘记了添加参数(您可以拥有它,但没有显示它)!而且,这种颜色不存在,所以我会仔细检查你的十六进制。下面是你如何解决你的问题:
@bot.event
async def on_message(message): # I defined my message
channel = message.channel
embed = discord.Embed(
title = f"Okay {message.author.name}#{message.author.discriminator}",
# I did this only so that way if the event gets called in a private channel ^,
# you wont get an error (message.author returns abc.User if it's in a private channel.)
description = f"Command cancelled. You might get better results with a second read.\n\nOr please see {info_chan} under 'Updating Stats' for other update options.",
color = CC79A7) # did a pink for you
await channel.send(embed=embed)您可以在此处查看discord.py文档:https://discordpy.readthedocs.io/en/latest/api.html?highlight=embed#discord.Embed.colour
https://stackoverflow.com/questions/65178334
复制相似问题